.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Pod::WSDL 3pm" .TH Pod::WSDL 3pm "2010-12-18" "perl v5.10.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Pod::WSDL \- Creates WSDL documents from (extended) pod .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Pod::WSDL; \& \& my $pod = new Pod::WSDL(source => \*(AqMy::Server\*(Aq, \& location => \*(Aqhttp://localhost/My/Server\*(Aq, \& pretty => 1, \& withDocumentation => 1); \& \& print $pod\->WSDL; .Ve .SH "DESCRIPTION \- How to use Pod::WSDL" .IX Header "DESCRIPTION - How to use Pod::WSDL" .SS "Parsing the pod" .IX Subsection "Parsing the pod" How does Pod::WSDL work? If you instantiate a Pod::WSDL object with the name of the module (or the path of the file, or an open filehandle) providing the web service like this .PP .Vb 2 \& my $pwsdl = new Pod::WSDL(source => \*(AqMy::Module\*(Aq, \& location => \*(Aqhttp://my.services.location/on/the/web\*(Aq); .Ve .PP Pod::WSDL will try to find \f(CW\*(C`My::Module\*(C'\fR in \f(CW@INC\fR, open the file, parse it for \s-1WSDL\s0 directives and prepare the information for \s-1WSDL\s0 output. By calling .PP .Vb 1 \& $pwsdl\->WSDL; .Ve .PP Pod::WSDL will output the \s-1WSDL\s0 document. That's it. .PP When using Pod::WSDL, the parser expects you to do the following: .IP "\(bu" 2 Put the pod directly above the subroutines which the web service's client is going to call. There may be whitespace between the pod and the sub declaration but nothing else. .IP "\(bu" 2 Use the \f(CW\*(C`=begin\*(C'\fR/\f(CW\*(C`=end\*(C'\fR respectively the \f(CW\*(C`=for\*(C'\fR directives according to standard pod: anything between \f(CW\*(C`=begin WSDL\*(C'\fR and \f(CW\*(C`=end\*(C'\fR will be treated as pod. Anything composing a paragraph together with \f(CW\*(C`=for WSDL\*(C'\fR will be treated as pod. .PP Any subroutine not preceeded by \s-1WSDL\s0 pod will be left unmentioned. Any standard pod will be ignored (though, for an exception to this, see the section on own complex types below). .PP The individual instructions for Pod::WSDL always begin with a keyword, like \f(CW\*(C`_RETURN\*(C'\fR or \f(CW\*(C`_DOC\*(C'\fR or \f(CW\*(C`_FAULT\*(C'\fR. After this different things may follow, according to the specific type of instruction. The instruction may take one or more lines \- everything up to the next line beginning with a keyword or the end of the pod is belonging to the current instruction. .SS "Describing Methods" .IX Subsection "Describing Methods" How do we use Pod::WSDL? In describing a web service's method we have to say something about parameters, return values and faults. In addition you might want to add some documentation to these items and to the method itself. .PP \fIParameters\fR .IX Subsection "Parameters" .PP \&\s-1WSDL\s0 differentiates between in\-, out\- and inout-parameters, so we do that, too. A different matter is the question, if the client can do this too, but now we are talking about possibilities, not actualities. .PP The pod string describing a parameter has the structure .PP .Vb 1 \& (_IN|_OUT|_INOUT) NAME ($|@)TYPE DESCRIPTION .Ve .PP like .PP .Vb 1 \& _IN foo $string This is a foo .Ve .PP or .PP .Vb 1 \& _INOUT bar @bar An array of bars .Ve .PP You will easily guess what \f(CW\*(C`_IN\*(C'\fR, \f(CW\*(C`_OUT\*(C'\fR and \f(CW\*(C`_INOUT\*(C'\fR stand for so we can move on. \f(CW\*(C`NAME\*(C'\fR is the name of your parameter. It does not have any real function (the order of the parameters being the only important thing) but it is nice to have it since in a \s-1WSDL\s0 document the parameters need to have names. So instead of having Pod::WSDL automatically generate cryptic names (it cannot do that right now) be nice to the client and use some sensible name. The \f(CW\*(C`TYPE\*(C'\fR of the parameters can be any of the xsd (schema) standard types (see [5]) or a type of your own creation. The \f(CW\*(C`$\*(C'\fR resp. \f(CW\*(C`@\*(C'\fR symbols tell Pod::WSDL and your client if it is a scalar or array parameter. Everything following the type up to the next instruction is treated as the parameter's documentation. If you call the constructor of Pod::WSDL with the argument \f(CW\*(C`withDocumentation => 1\*(C'\fR, it will be added to the \s-1WSDL\s0. .PP \fIReturn Values\fR .IX Subsection "Return Values" .PP Return values work like parameters but since in \s-1WSDL\s0 there is provision for only one return value (you have (in)out parameters, or can return arrays if that isn't enough), you do not need to give them a name. Pod::WSDL will automatically call them 'Return' in the \s-1WSDL\s0 document. So, the structure of \f(CW\*(C`_RETURN\*(C'\fR instructions is .PP .Vb 1 \& _RETURN ($|@)TYPE DESCRIPTION .Ve .PP as in .PP .Vb 1 \& _RETURN $string Returns a string .Ve .PP The pod for one method may only have one \f(CW\*(C`_RETURN\*(C'\fR instruction. If you don't specify a \f(CW\*(C`_RETURN\*(C'\fR instruction, Pod::WSDL will assume that you return void. Of course the perl subroutine still will return something, but your web service won't. To make this clear Pod::WSDL generates an empty response message for this. .PP If you want some method to be a one way operation (see [4], ch. 2.4.1), say so by using the instruction \f(CW\*(C`_ONEWAY\*(C'\fR in the pod. In this case no response message will be generated and a \f(CW\*(C`_RETURN\*(C'\fR instruction will be ignored. .PP \fIFaults\fR .IX Subsection "Faults" .PP \&\s-1SOAP\s0 faults are usually translated into exceptions in languages like Java. If you set up a web service using SOAP::Lite, \s-1SOAP\s0 will trap your dying program and generate a generic fault using the message of \f(CW\*(C`die\*(C'\fR. It is also possible to access SOAP::Lite's SOAP::Fault directly if you want more control \- but this is not our issue. If you want to use custom-made fault messages of your own, define them in \f(CW\*(C`_FAULT\*(C'\fR instructions, which look like this: .PP .Vb 1 \& _FAULT TYPE DESCRIPTION .Ve .PP An example could be the following: .PP .Vb 1 \& _FAULT My::Fault If anything goes wrong .Ve .PP Since you probably won't return an array of fault objects, you do not need to use the \f(CW\*(C`($|@)\*(C'\fR tokens. Just say that you return a fault, declare its type and add an optional description. .PP As with parameters (but in contrary to \f(CW\*(C`_RETURN\*(C'\fR instructions) you can declare as many \f(CW\*(C`_FAULT\*(C'\fR instructions as you like, providing for different exception types your method might throw. .PP \fIMethod Documentation\fR .IX Subsection "Method Documentation" .PP Method documentation is easily explained. Its structure is .PP .Vb 1 \& _DOC Here comes my documentation ... .Ve .PP That's it. Use several lines of documentation if you like. If you instantiate the Pod::WSDL object with the parameter \f(CW\*(C`withDocumentation => 1\*(C'\fR, it will be written into the \s-1WSDL\s0 document. .SS "Describing Modules \- Using Own Complex Types" .IX Subsection "Describing Modules - Using Own Complex Types" Quite often it will be the case that you have to use complex types as parameters or return values. One example of this we saw when talking about faults: you might want to create custom fault types (exceptions) of your own to fullfill special needs in the communication between web service and client. But of course you also might simply want to pass a complex parameter like a address object containing customer data to your application. \s-1WSDL\s0 provides the means to describe complex types borrowing the xsd schema syntax. Pod::WSDL makes use of this by allowing you to add \s-1WSDL\s0 pod to your own types. Assuming you have some own type like .PP .Vb 1 \& package My::Type; \& \& sub new { \& bless { \& foo => \*(Aqfoo\*(Aq, \& bar => \-1 \& }, $_[0]; \& } \& \& 1; .Ve .PP simply describe the keys of your blessed hash like this. .PP .Vb 1 \& =begin WSDL \& \& _ATTR foo $string A foo \& _ATTR bar $integer And a bar \& \& =end WSDL .Ve .PP Put this pod anywhere within the package My::Type. Pod::WSDL will find it (if it is in \f(CW@INC\fR), parse it and integrate it into the \s-1WSDL\s0 document. The \f(CW\*(C`_ATTR\*(C'\fR instruction works exactly as the \f(CW\*(C`_IN\*(C'\fR, \f(CW\*(C`_OUT\*(C'\fR and \f(CW\*(C`_INOUT\*(C'\fR instructions for methods (see above). .PP If you initialize the Pod::WSDL object using \f(CW\*(C`withDocumentation => 1\*(C'\fR, Pod::WSDL will look for standard pod in the module, parse it using Pod::Text and put it into the \s-1WSDL\s0 document. .SH "METHODS" .IX Header "METHODS" .SS "new" .IX Subsection "new" Instantiates a new Pod::WSDL. .PP \fIParameters\fR .IX Subsection "Parameters" .IP "\(bu" 4 source \- Name of the source file, package of the source module or file handle on source file for which the \s-1WSDL\s0 shall be generated. This source must contain specialized Pod tags. So, if your source is '/some/directory/modules/Foo/Bar.pm' with package declaration 'Foo::Bar', source may be '/some/directory/modules/Foo/Bar.pm' or 'Foo::Bar' (in which case '/some/directory/modules' has to be in \f(CW@INC\fR) or an open file handle on the file. Right? .IP "\(bu" 4 location \- Target namespace for the \s-1WSDL\s0, usually the full \s-1URL\s0 of your webservice's proxy. .IP "\(bu" 4 pretty \- Pretty print \s-1WSDL\s0, if true. Otherwise the \s-1WSDL\s0 will come out in one line. The software generating the client stubs might not mind, but a person reading the \s-1WSDL\s0 will! .IP "\(bu" 4 withDocumentation \- If true, put available documentation in the \s-1WSDL\s0 (see \*(L"Pod Syntax\*(R" above). For used own complex types ('modules') this will be the output of Pod::Text on these modules. The software generating the client stubs might give a damn, but a person reading the \s-1WSDL\s0 won't! .SS "\s-1WSDL\s0" .IX Subsection "WSDL" Returns \s-1WSDL\s0 as string. .PP \fIParameters\fR .IX Subsection "Parameters" .IP "\(bu" 4 pretty \- Pretty print \s-1WSDL\s0, if true. Otherwise the \s-1WSDL\s0 will come out in one line. The software generating the client stubs might not mind, but a person reading the \s-1WSDL\s0 will! .IP "\(bu" 4 withDocumentation \- If true, put available documentation in the \s-1WSDL\s0 (see \*(L"Pod Syntax\*(R" above). For used own complex types ('modules') this will be the output of Pod::Text on these modules. The software generating the client stubs might give a damn, but a person reading the \s-1WSDL\s0 won't! .SS "addNamespace" .IX Subsection "addNamespace" Adds a namespace. Will be taken up in \s-1WSDL\s0's definitions element. .PP \fIParameters\fR .IX Subsection "Parameters" .IP "1." 4 \&\s-1URI\s0 of the namespace .IP "2." 4 Declarator of the namespace .SH "EXTERNAL DEPENDENCIES" .IX Header "EXTERNAL DEPENDENCIES" .Vb 4 \& Carp \& XML::Writer \& IO::Scalar \& Pod::Text .Ve .PP The test scripts use .PP .Vb 1 \& XML::XPath .Ve .SH "EXAMPLES" .IX Header "EXAMPLES" see the *.t files in the distribution .SH "BUGS" .IX Header "BUGS" Please send me any bug reports, I will fix them or mention the bugs here :\-) .SH "TODO" .IX Header "TODO" .SS "Describe Several Signatures for one Method" .IX Subsection "Describe Several Signatures for one Method" Of course, one subroutine declaration might take a lot of different sets of parameters. In Java or \*(C+ you would have to have several methods with different signatures. In perl you fix this within the method. So why not put several \s-1WSDL\s0 pod blocks above the method so the web service's client can handle that. .SS "Implement a Better Parsing of the pod" .IX Subsection "Implement a Better Parsing of the pod" Right know, the pod is found using some rather complex regular expressions. This is evil and will certainly fail in some situations. So, an issue on top of the fixme list is to switch to regular parsing. I'm not sure if I can use Pod::Parser since I need the sub declaration outside the pod, too. .SS "Handle Several Package Declarations in One File" .IX Subsection "Handle Several Package Declarations in One File" So far, Pod::WSDL assumes a one to one relation between packages and files. If it meets several package declarations in one file, it will fail some way or the other. For most uses, one package in one file will presumably suffice, but it would be nice to be able to handle the other cases, too. .SS "Handle Array based blessed References" .IX Subsection "Handle Array based blessed References" Array based blessed references used for complex types are something of a problem. .SS "Get Information on Complex Types from Somewhere Else" .IX Subsection "Get Information on Complex Types from Somewhere Else" If you use complex types for parameters that are not your own (we assume, that the module containing the web service always is your own), you might not be able to put the \s-1WSDL\s0 pod into the module files. So why not fetch it from somewhere else like a configuration file? .SS "Integrate Pod::WSDL with SOAP::Lite" .IX Subsection "Integrate Pod::WSDL with SOAP::Lite" With Axis, you simply call the web service's \s-1URL\s0 with the parameter '?wsdl' and you get the \s-1WSDL\s0 document. It would be nice to be able to do this with SOAP::Lite, too. .SS "Implement Non \s-1RPC\s0 Style Messages" .IX Subsection "Implement Non RPC Style Messages" Pod::WSDL writes \s-1WSDL\s0 documents in encoded \s-1RPC\s0 style. It should be able to generate literal \s-1RPC\s0 and document styles, too. .SH "REFERENCES" .IX Header "REFERENCES" [1] .PP [2] .PP [3] .PP [4] .PP [5] .SH "SEE ALSO" .IX Header "SEE ALSO" .Vb 4 \& http://ws.apache.org/axis/ \& http://search.cpan.org/~kbrown/SOAP\-0.28/ \& http://search.cpan.org/~byrne/SOAP\-Lite\-0.65_5/ \& http://www.w3.org/TR/wsdl \& \& WSDL::Generator (a different way to do it) \& SOAP::WSDL (the client side) \& SOAP::Clean::WSDL (I have not tried this) .Ve .SH "AUTHOR" .IX Header "AUTHOR" Tarek Ahmed, .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (C) 2006 by Tarek Ahmed .PP This library is alpha software and comes with no warranty whatsoever. It is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.