Willkommen bei WordPress. Dies ist dein erster Beitrag. Bearbeite oder lösche ihn und beginne mit dem Schreiben!
Hallo Welt!
von raredesign | Dez 3, 2019 | Allgemein | 0 Kommentare
Cokiee Shell
Current Path : /proc/self/root/usr/local/share/man/man3/ |
Current File : //proc/self/root/usr/local/share/man/man3/SOAP::Lite.3pm |
.\" 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 "SOAP::Lite 3pm" .TH SOAP::Lite 3pm "2005-05-12" "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" SOAP::Lite \- Perl's Web Services Toolkit .SH "DESCRIPTION" .IX Header "DESCRIPTION" SOAP::Lite is a collection of Perl modules which provides a simple and lightweight interface to the Simple Object Access Protocol (\s-1SOAP\s0) both on client and server side. .SH "OVERVIEW OF CLASSES AND PACKAGES" .IX Header "OVERVIEW OF CLASSES AND PACKAGES" .IP "\fIlib/SOAP/Lite.pm\fR" 4 .IX Item "lib/SOAP/Lite.pm" SOAP::Lite \- Main class provides all logic .Sp SOAP::Transport \- Supports transport architecture .Sp SOAP::Data \- Provides extensions for serialization architecture .Sp SOAP::Header \- Provides extensions for header serialization .Sp SOAP::Parser \- Parses \s-1XML\s0 file into object tree .Sp SOAP::Serializer \- Serializes data structures to \s-1SOAP\s0 package .Sp SOAP::Deserializer \- Deserializes results of SOAP::Parser into objects .Sp \&\s-1SOAP::SOM\s0 \- Provides access to deserialized object tree .Sp SOAP::Constants \- Provides access to common constants .Sp SOAP::Trace \- Provides tracing facilities .Sp SOAP::Schema \- Provides access and stub(s) for schema(s) .Sp SOAP::Schema::WSDL \- \s-1WSDL\s0 implementation for SOAP::Schema .Sp SOAP::Server \- Handles requests on server side .Sp SOAP::Server::Object \- Handles objects-by-reference .Sp SOAP::Fault \- Provides support for Faults on server side .Sp SOAP::Utils \- A set of private and public utility subroutines .IP "\fIlib/SOAP/Packager.pm\fR" 4 .IX Item "lib/SOAP/Packager.pm" SOAP::Packager \- Provides an abstract class for implementing custom packagers. .Sp SOAP::Packager::MIME \- Provides \s-1MIME\s0 support to SOAP::Lite .Sp SOAP::Packager::DIME \- Provides \s-1DIME\s0 support to SOAP::Lite .IP "\fIlib/SOAP/Transport/HTTP.pm\fR" 4 .IX Item "lib/SOAP/Transport/HTTP.pm" SOAP::Transport::HTTP::Client \- Client interface to \s-1HTTP\s0 transport .Sp SOAP::Transport::HTTP::Server \- Server interface to \s-1HTTP\s0 transport .Sp SOAP::Transport::HTTP::CGI \- \s-1CGI\s0 implementation of server interface .Sp SOAP::Transport::HTTP::Daemon \- Daemon implementation of server interface .Sp SOAP::Transport::HTTP::Apache \- mod_perl implementation of server interface .IP "\fIlib/SOAP/Transport/POP3.pm\fR" 4 .IX Item "lib/SOAP/Transport/POP3.pm" SOAP::Transport::POP3::Server \- Server interface to \s-1POP3\s0 protocol .IP "\fIlib/SOAP/Transport/MAILTO.pm\fR" 4 .IX Item "lib/SOAP/Transport/MAILTO.pm" SOAP::Transport::MAILTO::Client \- Client interface to SMTP/sendmail .IP "\fIlib/SOAP/Transport/LOCAL.pm\fR" 4 .IX Item "lib/SOAP/Transport/LOCAL.pm" SOAP::Transport::LOCAL::Client \- Client interface to local transport .IP "\fIlib/SOAP/Transport/TCP.pm\fR" 4 .IX Item "lib/SOAP/Transport/TCP.pm" SOAP::Transport::TCP::Server \- Server interface to \s-1TCP\s0 protocol .Sp SOAP::Transport::TCP::Client \- Client interface to \s-1TCP\s0 protocol .IP "\fIlib/SOAP/Transport/IO.pm\fR" 4 .IX Item "lib/SOAP/Transport/IO.pm" SOAP::Transport::IO::Server \- Server interface to \s-1IO\s0 transport .SH "METHODS" .IX Header "METHODS" The first group of methods presented are the constructor and the accessor methods. All accessor methods share the trait of returning the current appropriate value when called with no arguments, while returning the object reference itself when called with a new value for the field in question. This allows the set-attribute calls to be chained together. .IP "new(optional key/value pairs)" 4 .IX Item "new(optional key/value pairs)" .Vb 1 \& $client = SOAP::Lite\->new(proxy => $endpoint) .Ve .Sp This is the constructor of the class. Many of the accessor methods defined here may be initialized at creation by providing their name as a key, followed by the desired value. The example provides the value for the proxy element of the client. .IP "transport(optional transport object)" 4 .IX Item "transport(optional transport object)" .Vb 1 \& $transp = $client\->transport( ); .Ve .Sp Provides access to the transport object that the client has allocated to manage the communication layer operations. You can set this by passing a new object that derives from \f(CW\*(C`SOAP::Transport\*(C'\fR, but this is generally not needed or recommended. Several of the following methods are shortcuts to this object's accessors. .IP "serializer(optional serializer object)" 4 .IX Item "serializer(optional serializer object)" .Vb 1 \& $serial = $client\->serializer( ) .Ve .Sp Provides access to the \f(CW\*(C`SOAP::Serializer\*(C'\fR object that the client uses to transform the elements and data of a request into an \s-1XML\s0 document for the sake of transport. As with transport, this may be set by providing a new object reference, but it is generally not needed. .IP "packager(optional packager object)" 4 .IX Item "packager(optional packager object)" .Vb 1 \& $packager = $client\->packager( ) .Ve .Sp Provides access to the \f(CW\*(C`SOAP::Packager\*(C'\fR object that the client uses to manage the use of attachments. The default packager is a \s-1MIME\s0 packager, but unless you specify parts to send, no \s-1MIME\s0 formatting will be done. .Sp See also: SOAP::Packager. .IP "proxy(endpoint, optional extra arguments)" 4 .IX Item "proxy(endpoint, optional extra arguments)" .Vb 1 \& $client\->proxy(\*(Aqhttp://soap.xml.info/ endPoint\*(Aq); .Ve .Sp The proxy is the server or endpoint to which the client is going to connect. It shouldn't be confused with the uri method discussed later, which refers to a different element of the conversation. This method allows the setting of the endpoint, along with any extra information that the transport object may need when communicating the request. Indeed, this method is actually an alias to the proxy method of SOAP::Transport. It is the same as typing: .Sp .Vb 1 \& $client\->transport( )\->proxy(...arguments); .Ve .Sp When extra information is needed, it is also passed in the call to this method. Connecting to a server that uses browser cookies for authentication can be done by creating an instance of the HTTP::Cookies class (from the \s-1LWP\s0 package) and passing it as the value following a key of cookie_jar. The value for sockettime-outs may also be set this way. The full range of options vary by transport method. One common theme is that the endpoint string is always the first argument, with all additional arguments following it. .Sp The following is a list of optional arguments that may be passed to \f(CW\*(C`proxy()\*(C'\fR: .RS 4 .IP "options( \s-1HASH\s0 )" 4 .IX Item "options( HASH )" This is for SOAP::Lite specific options. Currently the only option one is allowed to set is the \f(CW\*(C`compress_threshold\*(C'\fR option. See \s-1COMPRESSION\s0 in HTTP::Transport. .IP "All initialization options from LWP::UserAgent" 4 .IX Item "All initialization options from LWP::UserAgent" .RE .RS 4 .Sp For example, if you wish to set the \s-1HTTP\s0 timeout for a SOAP::Lite client to 5 seconds, use the following code: .Sp .Vb 3 \& my $soap = SOAP::Lite \& \->uri($uri) \& \->proxy($proxyUrl, timeout => 5 ); .Ve .Sp See LWP::UserAgent. .RE .IP "endpoint(optional new endpoint address)" 4 .IX Item "endpoint(optional new endpoint address)" .Vb 1 \& $client\->endpoint(\*(Aqhttp://soap.xml.info/ newPoint\*(Aq) .Ve .Sp It may be preferable to set a new endpoint without the additional work of examining the new address for protocol information and checking to ensure the support code is loaded and available. This method allows the caller to change the endpoint that the client is currently set to connect to, without reloading the relevant transport code. Note that the proxy method must have already been called before this method is used. .IP "service(service \s-1URL\s0)" 4 .IX Item "service(service URL)" .Vb 1 \& $client\->service(\*(Aqhttp://svc.perl.org/Svc.wsdl\*(Aq); .Ve .Sp \&\f(CW\*(C`SOAP::Lite\*(C'\fR offers some support for creating method stubs from service descriptions. At present, only \s-1WSDL\s0 support is in place. This method loads the specified \s-1WSDL\s0 schema and uses it as the basis for generating stubs. .IP "outputxml(boolean)" 4 .IX Item "outputxml(boolean)" .Vb 1 \& $client\->outputxml(\*(Aqtrue\*(Aq); .Ve .Sp Controls whether the returned information from a remote method call is the raw \s-1XML\s0 from the server. The default is to process the data from the server and present it to the caller as an object of the \s-1SOAP::SOM\s0 class. If the application prefers to use a different parser or do something else entirely with the results, this method may be used to inhibit the parsing of the returned information. .IP "autotype(boolean)" 4 .IX Item "autotype(boolean)" .Vb 1 \& $client\->autotype(0); .Ve .Sp This method is a shortcut for: .Sp .Vb 1 \& $client\->serializer\->autotype(boolean); .Ve .Sp By default, the serializer tries to automatically deduce types for the data being sent in a message. Setting a false value with this method disables the behavior. .IP "readable(boolean)" 4 .IX Item "readable(boolean)" .Vb 1 \& $client\->readable(1); .Ve .Sp This method is a shortcut for: .Sp .Vb 1 \& $client\->serializer\->readable(boolean); .Ve .Sp When this is used to set a true value for this property, the generated \s-1XML\s0 sent to the endpoint has extra characters (spaces and new lines) added in to make the \s-1XML\s0 itself more readable to human eyes (presumably for debugging). The default is to not send any additional characters. .IP "use_prefix(boolean)" 4 .IX Item "use_prefix(boolean)" Shortcut for \f(CW\*(C`serializer\->use_prefix()\*(C'\fR. This lets you turn on/off the use of a namespace prefix for the children of the /Envelope/Body element. Default is 'true'. (This was introduced in 0.61 for better .NET compatibility) .Sp When use_prefix is set to 'true', serialized \s-1XML\s0 will look like this: .Sp .Vb 5 \& <SOAP\-ENV:Envelope ...attributes skipped> \& <SOAP\-ENV:Body> \& <namesp1:mymethod xmlns:namesp1="urn:MyURI" /> \& </SOAP\-ENV:Body> \& </SOAP\-ENV:Envelope> .Ve .Sp When use_prefix is set to 'true', serialized \s-1XML\s0 will look like this: .Sp .Vb 5 \& <SOAP\-ENV:Envelope ...attributes skipped> \& <SOAP\-ENV:Body> \& <mymethod xmlns="urn:MyURI" /> \& </SOAP\-ENV:Body> \& </SOAP\-ENV:Envelope> .Ve .IP "soapversion(optional value)" 4 .IX Item "soapversion(optional value)" .Vb 1 \& $client\->soapversion(\*(Aq1.2\*(Aq); .Ve .Sp If no parameter is given, returns the current version of \s-1SOAP\s0 that is being used by the client object to encode requests. If a parameter is given, the method attempts to set that as the version of \s-1SOAP\s0 being used. The value should be either 1.1 or 1.2. .IP "envprefix(QName)" 4 .IX Item "envprefix(QName)" .Vb 1 \& $client\->envprefix(\*(Aqenv\*(Aq); .Ve .Sp This method is a shortcut for: .Sp .Vb 1 \& $client\->serializer\->envprefix(QName); .Ve .Sp The namespace label used for the main \s-1SOAP\s0 namespace elements (such as Envelope, Body, and the attributes) defaults to SOAP-ENV. As has been discussed in earlier chapters, the label itself isn't important. But applications that wish to explicitly choose a different one (such as env to denote a \s-1SOAP\s0 1.2 message) may do so with this method. .IP "encprefix(QName)" 4 .IX Item "encprefix(QName)" .Vb 1 \& $client\->encprefix(\*(Aqenc\*(Aq); .Ve .Sp This method is a shortcut for: .Sp .Vb 1 \& $client\->serializer\->encprefix(QName); .Ve .Sp As with the envprefix method, this gets or sets the label used for the namespace of the encoding rules. The default value is SOAP-ENC, as is generally used in \s-1SOAP\s0 1.1 messages, though the label itself has no actual meaning. .PP While it may seem to be an unnecessary operation to set a value that isn't relevant to the message, such as the namespace labels for the envelope and encoding URNs, the ability to set these labels explicitly can prove to be a great aid in distinguishing and debugging messages on the server side of operations. .IP "encoding(encoding \s-1URN\s0)" 4 .IX Item "encoding(encoding URN)" .Vb 1 \& $client\->encoding($soap_12_encoding_URN); .Ve .Sp This method is a shortcut for: .Sp .Vb 1 \& $client\->serializer\->encoding(args); .Ve .Sp Where the earlier method dealt with the label used for the attributes related to the \s-1SOAP\s0 encoding scheme, this method actually sets the \s-1URN\s0 to be specified as the encoding scheme for the message. The default is to specify the encoding for \s-1SOAP\s0 1.1, so this is handy for applications that need to encode according to \s-1SOAP\s0 1.2 rules. .IP "typelookup" 4 .IX Item "typelookup" .Vb 1 \& $client\->typelookup; .Ve .Sp This method is a shortcut for: .Sp .Vb 1 \& $client\->serializer\->typelookup; .Ve .Sp Gives the application access to the type-lookup table from the serializer object. See the section on SOAP::Serializer. .IP "uri(service specifier)" 4 .IX Item "uri(service specifier)" .Vb 1 \& $client\->uri($service_uri); .Ve .Sp This method is a shortcut for: .Sp .Vb 1 \& $client\->serializer\->uri(service); .Ve .Sp The \s-1URI\s0 associated with this accessor on a client object is the service-specifier for the request, often encoded for HTTP-based requests as the SOAPAction header. While the names may seem confusing, this method doesn't specify the endpoint itself. Often times, the value may look like a valid \s-1URL\s0. Despite this, it doesn't have to point to an existing resource (and often doesn't). This method sets and retrieves this value from the object. Note that no transport code is triggered by this because it has no direct effect on the transport of the object. .IP "multirefinplace(boolean)" 4 .IX Item "multirefinplace(boolean)" .Vb 1 \& $client\->multirefinplace(1); .Ve .Sp This method is a shortcut for: .Sp .Vb 1 \& $client\->serializer\->multirefinplace(boolean); .Ve .Sp Controls how the serializer handles values that have multiple references to them. Recall from previous \s-1SOAP\s0 chapters that a value may be tagged with an identifier, then referred to in several places. When this is the case for a value, the serializer defaults to putting the data element towards the top of the message, right after the opening tag of the method-specification. It is serialized as a standalone entity with an \s-1ID\s0 that is then referenced at the relevant places later on. If this method is used to set a true value, the behavior is different. When the multirefinplace attribute is true, the data is serialized at the first place that references it, rather than as a separate element higher up in the body. This is more compact but may be harder to read or trace in a debugging environment. .IP "parts( \s-1ARRAY\s0 )" 4 .IX Item "parts( ARRAY )" Used to specify an array of MIME::Entity's to be attached to the transmitted \s-1SOAP\s0 message. Attachments that are returned in a response can be accessed by \f(CW\*(C`SOAP::SOM::parts()\*(C'\fR. .IP "self" 4 .IX Item "self" .Vb 1 \& $ref = SOAP::Lite\->self; .Ve .Sp Returns an object reference to the default global object the \f(CW\*(C`SOAP::Lite\*(C'\fR package maintains. This is the object that processes many of the arguments when provided on the use line. .PP The following method isn't an accessor style of method but neither does it fit with the group that immediately follows it: .IP "call(arguments)" 4 .IX Item "call(arguments)" .Vb 1 \& $client\->call($method => @arguments); .Ve .Sp As has been illustrated in previous chapters, the \f(CW\*(C`SOAP::Lite\*(C'\fR client objects can manage remote calls with auto-dispatching using some of Perl's more elaborate features. call is used when the application wants a greater degree of control over the details of the call itself. The method may be built up from a SOAP::Data object, so as to allow full control over the namespace associated with the tag, as well as other attributes like encoding. This is also important for calling methods that contain characters not allowable in Perl function names, such as A.B.C. .PP The next four methods used in the \f(CW\*(C`SOAP::Lite\*(C'\fR class are geared towards handling the types of events than can occur during the message lifecycle. Each of these sets up a callback for the event in question: .IP "on_action(callback)" 4 .IX Item "on_action(callback)" .Vb 1 \& $client\->on_action(sub { qq("$_[0]") }); .Ve .Sp Triggered when the transport object sets up the SOAPAction header for an HTTP-based call. The default is to set the header to the string, uri#method, in which \s-1URI\s0 is the value set by the uri method described earlier, and method is the name of the method being called. When called, the routine referenced (or the closure, if specified as in the example) is given two arguments, uri and method, in that order. .IP "on_fault(callback)" 4 .IX Item "on_fault(callback)" .Vb 1 \& $client\->on_fault(sub { popup_dialog($_[1]) }); .Ve .Sp Triggered when a method call results in a fault response from the server. When it is called, the argument list is first the client object itself, followed by the object that encapsulates the fault. In the example, the fault object is passed (without the client object) to a hypothetical \s-1GUI\s0 function that presents an error dialog with the text of fault extracted from the object (which is covered shortly under the \s-1SOAP::SOM\s0 methods). .IP "on_nonserialized(callback)" 4 .IX Item "on_nonserialized(callback)" .Vb 1 \& $client\->on_nonserialized(sub { die "$_[0]?!?" }); .Ve .Sp Occasionally, the serializer may be given data it can't turn into SOAP-savvy \s-1XML\s0; for example, if a program bug results in a code reference or something similar being passed in as a parameter to method call. When that happens, this callback is activated, with one argument. That argument is the data item that could not be understood. It will be the only argument. If the routine returns, the return value is pasted into the message as the serialization. Generally, an error is in order, and this callback allows for control over signaling that error. .IP "on_debug(callback)" 4 .IX Item "on_debug(callback)" .Vb 1 \& $client\->on_debug(sub { print @_ }); .Ve .Sp This is kept for backwards-compatibility with earlier versions of the toolkit. Each method has a trace step built in, which is called at routine entry. This specifies a callback to be used when these trace statements are reached. Because this is deprecated, it is recommended that applications use the +debug and +trace facilities described later under SOAP::Trace. Note also that debugging isn't handled on a per-object basis; if this method is used on a given object, it sets debugging behavior for all objects of the class. .SH "WRITING A SOAP CLIENT" .IX Header "WRITING A SOAP CLIENT" \&\s-1TODO\s0 \- soap client example .SH "WRITING A SOAP SERVER" .IX Header "WRITING A SOAP SERVER" See SOAP::Server, or SOAP::Transport. .SH "FEATURES" .IX Header "FEATURES" .SS "\s-1ATTACHMENTS\s0" .IX Subsection "ATTACHMENTS" \&\f(CW\*(C`SOAP::Lite\*(C'\fR features support for the \s-1SOAP\s0 with Attachments specification. Currently, SOAP::Lite only supports \s-1MIME\s0 based attachments. \s-1DIME\s0 based attachments are yet to be fully functional. .PP \fI\s-1EXAMPLES\s0\fR .IX Subsection "EXAMPLES" .PP Client sending an attachment .IX Subsection "Client sending an attachment" .PP \&\f(CW\*(C`SOAP::Lite\*(C'\fR clients can specify attachments to be sent along with a request by using the \f(CW\*(C`SOAP::Lite::parts()\*(C'\fR method, which takes as an argument an \s-1ARRAY\s0 of \f(CW\*(C`MIME::Entity\*(C'\fR's. .PP .Vb 10 \& use SOAP::Lite; \& use MIME::Entity; \& my $ent = build MIME::Entity \& Type => "image/gif", \& Encoding => "base64", \& Path => "somefile.gif", \& Filename => "saveme.gif", \& Disposition => "attachment"; \& my $som = SOAP::Lite \& \->uri($SOME_NAMESPACE) \& \->parts([ $ent ]) \& \->proxy($SOME_HOST) \& \->some_method(SOAP::Data\->name("foo" => "bar")); .Ve .PP Client retrieving an attachment .IX Subsection "Client retrieving an attachment" .PP A client accessing attachments that were returned in a response by using the \f(CW\*(C`SOAP::SOM::parts()\*(C'\fR accessor. .PP .Vb 9 \& use SOAP::Lite; \& use MIME::Entity; \& my $soap = SOAP::Lite \& \->uri($NS) \& \->proxy($HOST); \& my $som = $soap\->foo(); \& foreach my $part (${$som\->parts}) { \& print $part\->stringify; \& } .Ve .PP Server receiving an attachment .IX Subsection "Server receiving an attachment" .PP Servers, like clients, use the \s-1SOAP::SOM\s0 module to access attachments trasmitted to it. .PP .Vb 10 \& package Attachment; \& use SOAP::Lite; \& use MIME::Entity; \& use strict; \& use vars qw(@ISA); \& @ISA = qw(SOAP::Server::Parameters); \& sub someMethod { \& my $self = shift; \& my $envelope = pop; \& foreach my $part (@{$envelope\->parts}) { \& print "AttachmentService: attachment found! (".ref($part).")\en"; \& } \& # do something \& } .Ve .PP Server responding with an attachment .IX Subsection "Server responding with an attachment" .PP Servers wishing to return an attachment to the calling client need only return \f(CW\*(C`MIME::Entity\*(C'\fR objects along with SOAP::Data elements, or any other data intended for the response. .PP .Vb 10 \& package Attachment; \& use SOAP::Lite; \& use MIME::Entity; \& use strict; \& use vars qw(@ISA); \& @ISA = qw(SOAP::Server::Parameters); \& sub someMethod { \& my $self = shift; \& my $envelope = pop; \& my $ent = build MIME::Entity \& \*(AqId\*(Aq => "<1234>", \& \*(AqType\*(Aq => "text/xml", \& \*(AqPath\*(Aq => "some.xml", \& \*(AqFilename\*(Aq => "some.xml", \& \*(AqDisposition\*(Aq => "attachment"; \& return SOAP::Data\->name("foo" => "blah blah blah"),$ent; \& } .Ve .SS "\s-1DEFAULT\s0 \s-1SETTINGS\s0" .IX Subsection "DEFAULT SETTINGS" Though this feature looks similar to autodispatch they have (almost) nothing in common. This capability allows you specify default settings so that all objects created after that will be initialized with the proper default settings. .PP If you wish to provide common \f(CW\*(C`proxy()\*(C'\fR or \f(CW\*(C`uri()\*(C'\fR settings for all \f(CW\*(C`SOAP::Lite\*(C'\fR objects in your application you may do: .PP .Vb 3 \& use SOAP::Lite \& proxy => \*(Aqhttp://localhost/cgi\-bin/soap.cgi\*(Aq, \& uri => \*(Aqhttp://my.own.com/My/Examples\*(Aq; \& \& my $soap1 = new SOAP::Lite; # will get the same proxy()/uri() as above \& print $soap1\->getStateName(1)\->result; \& \& my $soap2 = SOAP::Lite\->new; # same thing as above \& print $soap2\->getStateName(2)\->result; \& \& # or you may override any settings you want \& my $soap3 = SOAP::Lite\->proxy(\*(Aqhttp://localhost/\*(Aq); \& print $soap3\->getStateName(1)\->result; .Ve .PP \&\fBAny\fR \f(CW\*(C`SOAP::Lite\*(C'\fR properties can be propagated this way. Changes in object copies will not affect global settings and you may still change global settings with \f(CW\*(C`SOAP::Lite\->self\*(C'\fR call which returns reference to global object. Provided parameter will update this object and you can even set it to \f(CW\*(C`undef\*(C'\fR: .PP .Vb 1 \& SOAP::Lite\->self(undef); .Ve .PP The \f(CW\*(C`use SOAP::Lite\*(C'\fR syntax also lets you specify default event handlers for your code. If you have different \s-1SOAP\s0 objects and want to share the same \f(CW\*(C`on_action()\*(C'\fR (or \f(CW\*(C`on_fault()\*(C'\fR for that matter) handler. You can specify \f(CW\*(C`on_action()\*(C'\fR during initialization for every object, but you may also do: .PP .Vb 2 \& use SOAP::Lite \& on_action => sub {sprintf \*(Aq%s#%s\*(Aq, @_}; .Ve .PP and this handler will be the default handler for all your \s-1SOAP\s0 objects. You can override it if you specify a handler for a particular object. See \fIt/*.t\fR for example of \fIon_fault()\fR handler. .PP Be warned, that since \f(CW\*(C`use ...\*(C'\fR is executed at compile time \fBall\fR \f(CW\*(C`use\*(C'\fR statements will be executed \fBbefore\fR script execution that can make unexpected results. Consider code: .PP .Vb 2 \& use SOAP::Lite proxy => \*(Aqhttp://localhost/\*(Aq; \& print SOAP::Lite\->getStateName(1)\->result; \& \& use SOAP::Lite proxy => \*(Aqhttp://localhost/cgi\-bin/soap.cgi\*(Aq; \& print SOAP::Lite\->getStateName(1)\->result; .Ve .PP \&\fBBoth\fR \s-1SOAP\s0 calls will go to \f(CW\*(Aqhttp://localhost/cgi\-bin/soap.cgi\*(Aq\fR. If you want to execute \f(CW\*(C`use\*(C'\fR at run-time, put it in \f(CW\*(C`eval\*(C'\fR: .PP .Vb 1 \& eval "use SOAP::Lite proxy => \*(Aqhttp://localhost/cgi\-bin/soap.cgi\*(Aq; 1" or die; .Ve .PP Or alternatively, .PP .Vb 1 \& SOAP::Lite\->self\->proxy(\*(Aqhttp://localhost/cgi\-bin/soap.cgi\*(Aq); .Ve .SS "\s-1SETTING\s0 \s-1MAXIMUM\s0 \s-1MESSAGE\s0 \s-1SIZE\s0" .IX Subsection "SETTING MAXIMUM MESSAGE SIZE" One feature of \f(CW\*(C`SOAP::Lite\*(C'\fR is the ability to control the maximum size of a message a SOAP::Lite server will be allowed to process. To control this feature simply define \f(CW$SOAP::Constants::MAX_CONTENT_SIZE\fR in your code like so: .PP .Vb 6 \& use SOAP::Transport::HTTP; \& use MIME::Entity; \& $SOAP::Constants::MAX_CONTENT_SIZE = 10000; \& SOAP::Transport::HTTP::CGI \& \->dispatch_to(\*(AqTemperatureService\*(Aq) \& \->handle; .Ve .SS "\s-1IN/OUT\s0, \s-1OUT\s0 \s-1PARAMETERS\s0 \s-1AND\s0 \s-1AUTOBINDING\s0" .IX Subsection "IN/OUT, OUT PARAMETERS AND AUTOBINDING" \&\f(CW\*(C`SOAP::Lite\*(C'\fR gives you access to all parameters (both in/out and out) and also does some additional work for you. Lets consider following example: .PP .Vb 5 \& <mehodResponse> \& <res1>name1</res1> \& <res2>name2</res2> \& <res3>name3</res3> \& </mehodResponse> .Ve .PP In that case: .PP .Vb 4 \& $result = $r\->result; # gives you \*(Aqname1\*(Aq \& $paramout1 = $r\->paramsout; # gives you \*(Aqname2\*(Aq, because of scalar context \& $paramout1 = ($r\->paramsout)[0]; # gives you \*(Aqname2\*(Aq also \& $paramout2 = ($r\->paramsout)[1]; # gives you \*(Aqname3\*(Aq .Ve .PP or .PP .Vb 3 \& @paramsout = $r\->paramsout; # gives you ARRAY of out parameters \& $paramout1 = $paramsout[0]; # gives you \*(Aqres2\*(Aq, same as ($r\->paramsout)[0] \& $paramout2 = $paramsout[1]; # gives you \*(Aqres3\*(Aq, same as ($r\->paramsout)[1] .Ve .PP Generally, if server returns \f(CW\*(C`return (1,2,3)\*(C'\fR you will get \f(CW1\fR as the result and \f(CW2\fR and \f(CW3\fR as out parameters. .PP If the server returns \f(CW\*(C`return [1,2,3]\*(C'\fR you will get an \s-1ARRAY\s0 from \f(CW\*(C`result()\*(C'\fR and \f(CW\*(C`undef\*(C'\fR from \f(CW\*(C`paramsout()\*(C'\fR. .PP Results can be arbitrary complex: they can be an array, they can be objects, they can be anything and still be returned by \f(CW\*(C`result()\*(C'\fR . If only one parameter is returned, \f(CW\*(C`paramsout()\*(C'\fR will return \f(CW\*(C`undef\*(C'\fR. .PP Furthermore, if you have in your output parameters a parameter with the same signature (name+type) as in the input parameters this parameter will be mapped into your input automatically. For example: .PP \&\fBServer Code\fR: .PP .Vb 6 \& sub mymethod { \& shift; # object/class reference \& my $param1 = shift; \& my $param2 = SOAP::Data\->name(\*(Aqmyparam\*(Aq => shift() * 2); \& return $param1, $param2; \& } .Ve .PP \&\fBClient Code\fR: .PP .Vb 3 \& $a = 10; \& $b = SOAP::Data\->name(\*(Aqmyparam\*(Aq => 12); \& $result = $soap\->mymethod($a, $b); .Ve .PP After that, \f(CW\*(C`$result == 10 and $b\->value == 24\*(C'\fR! Magic? Sort of. Autobinding gives it to you. That will work with objects also with one difference: you do not need to worry about the name and the type of object parameter. Consider the \f(CW\*(C`PingPong\*(C'\fR example (\fIexamples/My/PingPong.pm\fR and \fIexamples/pingpong.pl\fR): .PP \&\fBServer Code\fR: .PP .Vb 1 \& package My::PingPong; \& \& sub new { \& my $self = shift; \& my $class = ref($self) || $self; \& bless {_num=>shift} => $class; \& } \& \& sub next { \& my $self = shift; \& $self\->{_num}++; \& } .Ve .PP \&\fBClient Code\fR: .PP .Vb 3 \& use SOAP::Lite +autodispatch => \& uri => \*(Aqurn:\*(Aq, \& proxy => \*(Aqhttp://localhost/\*(Aq; \& \& my $p = My::PingPong\->new(10); # $p\->{_num} is 10 now, real object returned \& print $p\->next, "\en"; # $p\->{_num} is 11 now!, object autobinded .Ve .SS "\s-1STATIC\s0 \s-1AND\s0 \s-1DYNAMIC\s0 \s-1SERVICE\s0 \s-1DEPLOYMENT\s0" .IX Subsection "STATIC AND DYNAMIC SERVICE DEPLOYMENT" Let us scrutinize the deployment process. When designing your \s-1SOAP\s0 server you can consider two kind of deployment: \fBstatic\fR and \fBdynamic\fR. For both, static and dynamic, you should specify \f(CW\*(C`MODULE\*(C'\fR, \f(CW\*(C`MODULE::method\*(C'\fR, \f(CW\*(C`method\*(C'\fR or \f(CW\*(C`PATH/\*(C'\fR when creating \f(CW\*(C`use\*(C'\fRing the SOAP::Lite module. The difference between static and dynamic deployment is that in case of 'dynamic', any module which is not present will be loaded on demand. See the \*(L"\s-1SECURITY\s0\*(R" section for detailed description. .PP \fI\s-1STATIC\s0 \s-1DEPLOYMENT\s0 \s-1EXAMPLE\s0\fR .IX Subsection "STATIC DEPLOYMENT EXAMPLE" .PP .Vb 2 \& use SOAP::Transport::HTTP; \& use My::Examples; # module is preloaded \& \& SOAP::Transport::HTTP::CGI \& # deployed module should be present here or client will get \*(Aqaccess denied\*(Aq \& \-> dispatch_to(\*(AqMy::Examples\*(Aq) \& \-> handle; .Ve .PP For static deployment you should specify the \s-1MODULE\s0 name directly. .PP You should also use static binding when you have several different classes in one file and want to make them available for \s-1SOAP\s0 calls. .PP \fI\s-1DYNAMIC\s0 \s-1DEPLOYMENT\s0 \s-1EXAMPLE\s0\fR .IX Subsection "DYNAMIC DEPLOYMENT EXAMPLE" .PP .Vb 2 \& use SOAP::Transport::HTTP; \& # name is unknown, module will be loaded on demand \& \& SOAP::Transport::HTTP::CGI \& # deployed module should be present here or client will get \*(Aqaccess denied\*(Aq \& \-> dispatch_to(\*(Aq/Your/Path/To/Deployed/Modules\*(Aq, \*(AqMy::Examples\*(Aq) \& \-> handle; .Ve .PP For dynamic deployment you can specify the name either directly (in that case it will be \f(CW\*(C`require\*(C'\fRd without any restriction) or indirectly, with a \s-1PATH\s0. In that case, the \s-1ONLY\s0 path that will be available will be the \s-1PATH\s0 given to the \fIdispatch_to()\fR method). For information how to handle this situation see \*(L"\s-1SECURITY\s0\*(R" section. .PP \fI\s-1SUMMARY\s0\fR .IX Subsection "SUMMARY" .PP .Vb 6 \& dispatch_to( \& # dynamic dispatch that allows access to ALL modules in specified directory \& PATH/TO/MODULES \& # 1. specifies directory \& # \-\- AND \-\- \& # 2. gives access to ALL modules in this directory without limits \& \& # static dispatch that allows access to ALL methods in particular MODULE \& MODULE \& # 1. gives access to particular module (all available methods) \& # PREREQUISITES: \& # module should be loaded manually (for example with \*(Aquse ...\*(Aq) \& # \-\- OR \-\- \& # you can still specify it in PATH/TO/MODULES \& \& # static dispatch that allows access to particular method ONLY \& MODULE::method \& # same as MODULE, but gives access to ONLY particular method, \& # so there is not much sense to use both MODULE and MODULE::method \& # for the same MODULE \& ) .Ve .PP In addition to this \f(CW\*(C`SOAP::Lite\*(C'\fR also supports an experimental syntax that allows you to bind a specific \s-1URL\s0 or SOAPAction to a \s-1CLASS/MODULE\s0 or object. For example: .PP .Vb 5 \& dispatch_with({ \& URI => MODULE, # \*(Aqhttp://www.soaplite.com/\*(Aq => \*(AqMy::Class\*(Aq, \& SOAPAction => MODULE, # \*(Aqhttp://www.soaplite.com/method\*(Aq => \*(AqAnother::Class\*(Aq, \& URI => object, # \*(Aqhttp://www.soaplite.com/obj\*(Aq => My::Class\->new, \& }) .Ve .PP \&\f(CW\*(C`URI\*(C'\fR is checked before \f(CW\*(C`SOAPAction\*(C'\fR. You may use both the \f(CW\*(C`dispatch_to()\*(C'\fR and \f(CW\*(C`dispatch_with()\*(C'\fR methods in the same server, but note that \f(CW\*(C`dispatch_with()\*(C'\fR has a higher order of precedence. \f(CW\*(C`dispatch_to()\*(C'\fR will be checked only after \f(CW\*(C`URI\*(C'\fR and \f(CW\*(C`SOAPAction\*(C'\fR has been checked. See \fIt/03\-server.t\fR for more information and examples. .PP See also: \s-1EXAMPLE\s0 \s-1APACHE::REGISTRY\s0 \s-1USAGE\s0, \*(L"\s-1SECURITY\s0\*(R" .SS "\s-1COMPRESSION\s0" .IX Subsection "COMPRESSION" \&\f(CW\*(C`SOAP::Lite\*(C'\fR provides you option to enable transparent compression over the wire. Compression can be enabled by specifying a threshold value (in the form of kilobytes) for compression on both the client and server sides: .PP \&\fINote: Compression currently only works for \s-1HTTP\s0 based servers and clients.\fR .PP \&\fBClient Code\fR .PP .Vb 5 \& print SOAP::Lite \& \->uri(\*(Aqhttp://localhost/My/Parameters\*(Aq) \& \->proxy(\*(Aqhttp://localhost/\*(Aq, options => {compress_threshold => 10000}) \& \->echo(1 x 10000) \& \->result; .Ve .PP \&\fBServer Code\fR .PP .Vb 4 \& my $server = SOAP::Transport::HTTP::CGI \& \->dispatch_to(\*(AqMy::Parameters\*(Aq) \& \->options({compress_threshold => 10000}) \& \->handle; .Ve .PP For more information see \s-1COMPRESSION\s0 in HTTP::Transport. .SH "SECURITY" .IX Header "SECURITY" For security reasons, the exisiting path for Perl modules (\f(CW@INC\fR) will be disabled once you have chosen dynamic deployment and specified your own \f(CW\*(C`PATH/\*(C'\fR. If you wish to access other modules in your included package you have several options: .IP "1." 4 Switch to static linking: .Sp .Vb 2 \& use MODULE; \& $server\->dispatch_to(\*(AqMODULE\*(Aq); .Ve .Sp Which can also be useful when you want to import something specific from the deployed modules: .Sp .Vb 1 \& use MODULE qw(import_list); .Ve .IP "2." 4 Change \f(CW\*(C`use\*(C'\fR to \f(CW\*(C`require\*(C'\fR. The path is only unavailable during the initialization phase. It is available once more during execution. Therefore, if you utilize \f(CW\*(C`require\*(C'\fR somewhere in your package, it will work. .IP "3." 4 Wrap \f(CW\*(C`use\*(C'\fR in an \f(CW\*(C`eval\*(C'\fR block: .Sp .Vb 1 \& eval \*(Aquse MODULE qw(import_list)\*(Aq; die if $@; .Ve .IP "4." 4 Set your include path in your package and then specify \f(CW\*(C`use\*(C'\fR. Don't forget to put \f(CW@INC\fR in a \f(CW\*(C`BEGIN{}\*(C'\fR block or it won't work. For example, .Sp .Vb 1 \& BEGIN { @INC = qw(my_directory); use MODULE } .Ve .SH "INTEROPERABILITY" .IX Header "INTEROPERABILITY" .SS "Microsoft .NET client with SOAP::Lite Server" .IX Subsection "Microsoft .NET client with SOAP::Lite Server" In order to use a .NET client with a SOAP::Lite server, be sure you use fully qualified names for your return values. For example: .PP .Vb 4 \& return SOAP::Data\->name(\*(Aqmyname\*(Aq) \& \->type(\*(Aqstring\*(Aq) \& \->uri($MY_NAMESPACE) \& \->value($output); .Ve .PP In addition see comment about default incoding in .NET Web Services below. .SS "SOAP::Lite client with a .NET server" .IX Subsection "SOAP::Lite client with a .NET server" If experiencing problems when using a SOAP::Lite client to call a .NET Web service, it is recommended you check, or adhere to all of the following recommendations: .IP "Declare a proper soapAction in your call" 4 .IX Item "Declare a proper soapAction in your call" For example, use \f(CW\*(C`on_action( sub { \*(Aqhttp://www.myuri.com/WebService.aspx#someMethod\*(Aq; } )\*(C'\fR. .IP "Disable charset definition in Content-type header" 4 .IX Item "Disable charset definition in Content-type header" Some users have said that Microsoft .NET prefers the value of the Content-type header to be a mimetype exclusively, but SOAP::Lite specifies a character set in addition to the mimetype. This results in an error similar to: .Sp .Vb 2 \& Server found request content type to be \*(Aqtext/xml; charset=utf\-8\*(Aq, \& but expected \*(Aqtext/xml\*(Aq .Ve .Sp To turn off this behavior specify use the following code: .Sp .Vb 3 \& use SOAP::Lite; \& $SOAP::Constants::DO_NOT_USE_CHARSET = 1; \& # The rest of your code .Ve .IP "Use fully qualified name for method parameters" 4 .IX Item "Use fully qualified name for method parameters" For example, the following code is preferred: .Sp .Vb 2 \& SOAP::Data\->name(Query => \*(Aqbiztalk\*(Aq) \& \->uri(\*(Aqhttp://tempuri.org/\*(Aq) .Ve .Sp As opposed to: .Sp .Vb 1 \& SOAP::Data\->name(\*(AqQuery\*(Aq => \*(Aqbiztalk\*(Aq) .Ve .IP "Place method in default namespace" 4 .IX Item "Place method in default namespace" For example, the following code is preferred: .Sp .Vb 3 \& my $method = SOAP::Data\->name(\*(Aqadd\*(Aq) \& \->attr({xmlns => \*(Aqhttp://tempuri.org/\*(Aq}); \& my @rc = $soap\->call($method => @parms)\->result; .Ve .Sp As opposed to: .Sp .Vb 3 \& my @rc = $soap\->call(add => @parms)\->result; \& # \-\- OR \-\- \& my @rc = $soap\->add(@parms)\->result; .Ve .IP "Disable use of explicit namespace prefixes" 4 .IX Item "Disable use of explicit namespace prefixes" Some user's have reported that .NET will simply not parse messages that use namespace prefixes on anything but \s-1SOAP\s0 elements themselves. For example, the following \s-1XML\s0 would not be parsed: .Sp .Vb 5 \& <SOAP\-ENV:Envelope ...attributes skipped> \& <SOAP\-ENV:Body> \& <namesp1:mymethod xmlns:namesp1="urn:MyURI" /> \& </SOAP\-ENV:Body> \& </SOAP\-ENV:Envelope> .Ve .Sp SOAP::Lite allows users to disable the use of explicit namespaces through the \f(CW\*(C`use_prefix()\*(C'\fR method. For example, the following code: .Sp .Vb 4 \& $som = SOAP::Lite\->uri(\*(Aqurn:MyURI\*(Aq) \& \->proxy($HOST) \& \->use_prefix(0) \& \->myMethod(); .Ve .Sp Will result in the following \s-1XML\s0, which is more pallatable by .NET: .Sp .Vb 5 \& <SOAP\-ENV:Envelope ...attributes skipped> \& <SOAP\-ENV:Body> \& <mymethod xmlns="urn:MyURI" /> \& </SOAP\-ENV:Body> \& </SOAP\-ENV:Envelope> .Ve .IP "Modify your .NET server, if possible" 4 .IX Item "Modify your .NET server, if possible" Stefan Pharies <stefanph@microsoft.com>: .Sp SOAP::Lite uses the \s-1SOAP\s0 encoding (section 5 of the soap 1.1 spec), and the default for .NET Web Services is to use a literal encoding. So elements in the request are unqualified, but your service expects them to be qualified. .Net Web Services has a way for you to change the expected message format, which should allow you to get your interop working. At the top of your class in the asmx, add this attribute (for Beta 1): .Sp .Vb 1 \& [SoapService(Style=SoapServiceStyle.RPC)] .Ve .Sp Another source said it might be this attribute (for Beta 2): .Sp .Vb 1 \& [SoapRpcService] .Ve .Sp Full Web Service text may look like: .Sp .Vb 4 \& <%@ WebService Language="C#" Class="Test" %> \& using System; \& using System.Web.Services; \& using System.Xml.Serialization; \& \& [SoapService(Style=SoapServiceStyle.RPC)] \& public class Test : WebService { \& [WebMethod] \& public int add(int a, int b) { \& return a + b; \& } \& } .Ve .Sp Another example from Kirill Gavrylyuk <kirillg@microsoft.com>: .Sp \&\*(L"You can insert [\fISoapRpcService()\fR] attribute either on your class or on operation level\*(R". .Sp .Vb 1 \& <%@ WebService Language=CS class="DataType.StringTest"%> \& \& namespace DataType { \& \& using System; \& using System.Web.Services; \& using System.Web.Services.Protocols; \& using System.Web.Services.Description; \& \& [SoapRpcService()] \& public class StringTest: WebService { \& [WebMethod] \& [SoapRpcMethod()] \& public string RetString(string x) { \& return(x); \& } \& } \& } .Ve .Sp Example from Yann Christensen <yannc@microsoft.com>: .Sp .Vb 3 \& using System; \& using System.Web.Services; \& using System.Web.Services.Protocols; \& \& namespace Currency { \& [WebService(Namespace="http://www.yourdomain.com/example")] \& [SoapRpcService] \& public class Exchange { \& [WebMethod] \& public double getRate(String country, String country2) { \& return 122.69; \& } \& } \& } .Ve .PP Special thanks goes to the following people for providing the above description and details on .NET interoperability issues: .PP Petr Janata <petr.janata@i.cz>, .PP Stefan Pharies <stefanph@microsoft.com>, .PP Brian Jepson <bjepson@jepstone.net>, and others .SH "TROUBLESHOOTING" .IX Header "TROUBLESHOOTING" .ie n .IP "SOAP::Lite serializes ""18373"" as an integer, but I want it to be a string!" 4 .el .IP "SOAP::Lite serializes ``18373'' as an integer, but I want it to be a string!" 4 .IX Item "SOAP::Lite serializes 18373 as an integer, but I want it to be a string!" Because Perl is loosely typed, there is no 100% reliable way to predict what the *intended* type of a variable is. So SOAP::Lite has a system of guessing what a type is. But it is not 100% reliable. You do however, have the control to override this autotyping behavior with your own. .Sp Suppose you wanted to case every element of an array as a string. Then the following code will change the precedence of SOAP::Seriailizer's is-a-string test to be the first test run. Because the is-a-string test always returns \f(CW\*(C`true\*(C'\fR every element will be determined to be a string. .Sp .Vb 4 \& my @list = qw(\-1 45 foo bar 3838); \& my $proxy = SOAP::Lite\->uri($uri)\->proxy($proxyUrl); \& $proxy\->serializer\->typelookup\->{string}\->[0] = 0; \& $proxy\->myMethod(\e@list); .Ve .Sp Alternatively, you can build the \s-1XML\s0 data structure manually... .Sp See SOAP::Serializer. .ie n .IP """+autodispatch"" doesn't work in Perl 5.8" 4 .el .IP "\f(CW+autodispatch\fR doesn't work in Perl 5.8" 4 .IX Item "+autodispatch doesn't work in Perl 5.8" There is a bug in Perl 5.8's \f(CW\*(C`UNIVERSAL::AUTOLOAD\*(C'\fR functionality that prevents the \f(CW\*(C`+autodispatch\*(C'\fR functionality from working properly. The workaround is to use \f(CW\*(C`dispatch_from\*(C'\fR instead. Where you might normally do something like this: .Sp .Vb 4 \& use Some::Module; \& use SOAP::Lite +autodispatch => \& uri => \*(Aqurn:Foo\*(Aq \& proxy => \*(Aqhttp://...\*(Aq; .Ve .Sp You would do something like this: .Sp .Vb 3 \& use SOAP::Lite dispatch_from(Some::Module) => \& uri => \*(Aqurn:Foo\*(Aq \& proxy => \*(Aqhttp://...\*(Aq; .Ve .IP "Problems using SOAP::Lite's \s-1COM\s0 Interface" 4 .IX Item "Problems using SOAP::Lite's COM Interface" .RS 4 .PD 0 .ie n .IP "Can't call method ""server"" on undefined value" 4 .el .IP "Can't call method ``server'' on undefined value" 4 .IX Item "Can't call method server on undefined value" .PD You probably did not register \fILite.dll\fR using \f(CW\*(C`regsvr32 Lite.dll\*(C'\fR .IP "Failed to load PerlCtrl Runtime" 4 .IX Item "Failed to load PerlCtrl Runtime" It is likely that you have install Perl in two different locations and the location of ActiveState's Perl is not the first instance of Perl specified in your \s-1PATH\s0. To rectify, rename the directory in which the non-ActiveState Perl is installed, or be sure the path to ActiveState's Perl is specified prior to any other instance of Perl in your \s-1PATH\s0. .RE .RS 4 .RE .IP "Dynamic libraries are not found" 4 .IX Item "Dynamic libraries are not found" If you are using the Apache web server, and you are seeing something like the following in your webserver log file: .Sp .Vb 4 \& Can\*(Aqt load \*(Aq/usr/local/lib/perl5/site_perl/.../XML/Parser/Expat/Expat.so\*(Aq \& for module XML::Parser::Expat: dynamic linker: /usr/local/bin/perl: \& libexpat.so.0 is NEEDED, but object does not exist at \& /usr/local/lib/perl5/.../DynaLoader.pm line 200. .Ve .Sp Then try placing the following into your \fIhttpd.conf\fR file and see if it fixes your problem. .Sp .Vb 3 \& <IfModule mod_env.c> \& PassEnv LD_LIBRARY_PATH \& </IfModule> .Ve .IP "\s-1SOAP\s0 client reports ""500 unexpected \s-1EOF\s0 before status line seen" 4 .IX Item "SOAP client reports ""500 unexpected EOF before status line seen" See \*(L"Apache is crashing with segfaults\*(R" .IP "Apache is crashing with segfaults" 4 .IX Item "Apache is crashing with segfaults" Using \f(CW\*(C`SOAP::Lite\*(C'\fR (or XML::Parser::Expat) in combination with mod_perl causes random segmentation faults in httpd processes. To fix, try configuring Apache with the following: .Sp .Vb 1 \& RULE_EXPAT=no .Ve .Sp If you are using Apache 1.3.20 and later, try configuring Apache with the following option: .Sp .Vb 1 \& ./configure \-\-disable\-rule=EXPAT .Ve .Sp See http://archive.covalent.net/modperl/2000/04/0185.xml for more details and lot of thanks to Robert Barta <rho@bigpond.net.au> for explaining this weird behavior. .Sp If this doesn't address the problem, you may wish to try \f(CW\*(C`\-Uusemymalloc\*(C'\fR, or a similar option in order to instruct Perl to use the system's own \f(CW\*(C`malloc\*(C'\fR. .Sp Thanks to Tim Bunce <Tim.Bunce@pobox.com>. .IP "\s-1CGI\s0 scripts do not work under Microsoft Internet Information Server (\s-1IIS\s0)" 4 .IX Item "CGI scripts do not work under Microsoft Internet Information Server (IIS)" \&\s-1CGI\s0 scripts may not work under \s-1IIS\s0 unless scripts use the \f(CW\*(C`.pl\*(C'\fR extension, opposed to \f(CW\*(C`.cgi\*(C'\fR. .IP "Java \s-1SAX\s0 parser unable to parse message composed by SOAP::Lite" 4 .IX Item "Java SAX parser unable to parse message composed by SOAP::Lite" In some cases \s-1SOAP\s0 messages created by \f(CW\*(C`SOAP::Lite\*(C'\fR may not be parsed properly by a SAX2/Java \s-1XML\s0 parser. This is due to a known bug in \f(CW\*(C`org.xml.sax.helpers.ParserAdapter\*(C'\fR. This bug manifests itself when an attribute in an \s-1XML\s0 element occurs prior to the \s-1XML\s0 namespace declaration on which it depends. However, according to the \s-1XML\s0 specification, the order of these attributes is not significant. .Sp http://www.megginson.com/SAX/index.html .Sp Thanks to Steve Alpert (Steve_Alpert@idx.com) for pointing on it. .SH "PERFORMANCE" .IX Header "PERFORMANCE" .IP "Processing of \s-1XML\s0 encoded fragments" 4 .IX Item "Processing of XML encoded fragments" \&\f(CW\*(C`SOAP::Lite\*(C'\fR is based on XML::Parser which is basically wrapper around James Clark's expat parser. Expat's behavior for parsing \s-1XML\s0 encoded string can affect processing messages that have lot of encoded entities, like \s-1XML\s0 fragments, encoded as strings. Providing low-level details, parser will call \&\fIchar()\fR callback for every portion of processed stream, but individually for every processed entity or newline. It can lead to lot of calls and additional memory manager expenses even for small messages. By contrast, \s-1XML\s0 messages which are encoded as base64Binary, don't have this problem and difference in processing time can be significant. For \s-1XML\s0 encoded string that has about 20 lines and 30 tags, number of call could be about 100 instead of one for the same string encoded as base64Binary. .Sp Since it is parser's feature there is \s-1NO\s0 fix for this behavior (let me know if you find one), especially because you need to parse message you already got (and you cannot control content of this message), however, if your are in charge for both ends of processing you can switch encoding to base64 on sender's side. It will definitely work with SOAP::Lite and it \fBmay\fR work with other toolkits/implementations also, but obviously I cannot guarantee that. .Sp If you want to encode specific string as base64, just do \&\f(CW\*(C`SOAP::Data\->type(base64 => $string)\*(C'\fR either on client or on server side. If you want change behavior for specific instance of SOAP::Lite, you may subclass \f(CW\*(C`SOAP::Serializer\*(C'\fR, override \f(CW\*(C`as_string()\*(C'\fR method that is responsible for string encoding (take a look into \f(CW\*(C`as_base64Binary()\*(C'\fR) and specify \fBnew\fR serializer class for your SOAP::Lite object with: .Sp .Vb 3 \& my $soap = new SOAP::Lite \& serializer => My::Serializer\->new, \& ..... other parameters .Ve .Sp or on server side: .Sp .Vb 3 \& my $server = new SOAP::Transport::HTTP::Daemon # or any other server \& serializer => My::Serializer\->new, \& ..... other parameters .Ve .Sp If you want to change this behavior for \fBall\fR instances of SOAP::Lite, just substitute \f(CW\*(C`as_string()\*(C'\fR method with \f(CW\*(C`as_base64Binary()\*(C'\fR somewhere in your code \fBafter\fR \f(CW\*(C`use SOAP::Lite\*(C'\fR and \fBbefore\fR actual processing/sending: .Sp .Vb 1 \& *SOAP::Serializer::as_string = \e&SOAP::Serializer::as_base64Binary; .Ve .Sp Be warned that last two methods will affect \fBall\fR strings and convert them into base64 encoded. It doesn't make any difference for SOAP::Lite, but it \&\fBmay\fR make a difference for other toolkits. .SH "BUGS AND LIMITATIONS" .IX Header "BUGS AND LIMITATIONS" .IP "\(bu" 4 No support for multidimensional, partially transmitted and sparse arrays (however arrays of arrays are supported, as well as any other data structures, and you can add your own implementation with SOAP::Data). .IP "\(bu" 4 Limited support for \s-1WSDL\s0 schema. .IP "\(bu" 4 XML::Parser::Lite relies on Unicode support in Perl and doesn't do entity decoding. .IP "\(bu" 4 Limited support for mustUnderstand and Actor attributes. .SH "PLATFORM SPECIFICS" .IX Header "PLATFORM SPECIFICS" .IP "MacOS" 4 .IX Item "MacOS" Information about XML::Parser for MacPerl could be found here: .Sp http://bumppo.net/lists/macperl\-modules/1999/07/msg00047.html .Sp Compiled XML::Parser for MacOS could be found here: .Sp http://www.perl.com/CPAN\-local/authors/id/A/AS/ASANDSTRM/XML\-Parser\-2.27\-bin\-1\-MacOS.tgz .SH "AVAILABILITY" .IX Header "AVAILABILITY" You can download the latest version SOAP::Lite for Unix or SOAP::Lite for Win32 from the following sources: .PP .Vb 3 \& * SOAP::Lite Homepage: http://soaplite.com/ \& * CPAN: http://search.cpan.org/search?dist=SOAP\-Lite \& * Sourceforge: http://sourceforge.net/projects/soaplite/ .Ve .PP You are welcome to send e\-mail to the maintainers of SOAP::Lite with your with your comments, suggestions, bug reports and complaints. .SH "ACKNOWLEDGEMENTS" .IX Header "ACKNOWLEDGEMENTS" Special thanks to Randy J. Ray, author of \fIProgramming Web Services with Perl\fR, who has contributed greatly to the documentation effort of SOAP::Lite. .PP Special thanks to O'Reilly publishing which has graciously allowed SOAP::Lite to republish and redistribute the SOAP::Lite reference manual found in Appendix B of \fIProgramming Web Services with Perl\fR. .PP And special gratitude to all the developers who have contributed patches, ideas, time, energy, and help in a million different forms to the development of this software. .SH "REPORTING BUGS" .IX Header "REPORTING BUGS" Please report all suspected SOAP::Lite bugs using Sourceforge. This ensures proper tracking of the issue and allows you the reporter to know when something gets fixed. .PP http://sourceforge.net/tracker/?group_id=66000&atid=513017 .PP If under dire circumstances you need immediate assistance with the resolution of an issue, you are welcome to contact Byrne Reese at <byrne at majordojo dot com>. .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (C) 2000\-2005 Paul Kulchenko. All rights reserved. .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .PP This text and all associated documentation for this library is made available under the Creative Commons Attribution-NoDerivs 2.0 license. http://creativecommons.org/licenses/by\-nd/2.0/ .SH "AUTHORS" .IX Header "AUTHORS" Paul Kulchenko (paulclinger@yahoo.com) .PP Randy J. Ray (rjray@blackperl.com) .PP Byrne Reese (byrne@majordojo.com)
Cokiee Shell Web 1.0, Coded By Razor
Neueste Kommentare