This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Appendix B: SOAP::Lite Programming Reference
one or a few values, consider retrieving the current reference value and using it
to set the key(s).
The SOAP::Server class provides the basic framework for the transport-specific server
classes to build upon. Note that in none of the code examples provided with
nor in any of the book examples, is this class used directly. Instead, it is
designed to be a superclass within more specific implementation classes. The meth-
ods provided by
SOAP::Server itself are:
new(optional key/value pairs) $server = SOAP::Server->new(%options);
Creates a new object of the class. Various default instance values are set up, and
like many of the constructors in this module, most of the class methods
described here may be passed in the construction call by giving the name fol-
lowed by the parameter (or an array reference if there are multiple parameters).
action(optional new value) $action = $server->action
Retrieves or sets the value of the action attribute on the server object. This
attribute is used when mapping the request to an appropriate namespace or rou-
tine. For example, the HTTP library sets the attribute to the value of the
SOAPAction header when processing of the request begins, so that the find_
method described later may retrieve the value to match it against the
server’s configuration. Returns the object itself when setting the attribute.
myuri(optional new value) $server->myuri("http://localhost:9000/SOAP");
Gets or sets the myuri attribute. This specifies the specific URI that the server is
answering requests to (which may be different from the value specified in
or in the SOAPAction header).
serializer(optional new value) $serializer = $server->serializer;
deserializer(optional new value) $server->deserializer($new_deser_obj);
As with the client objects, these methods provide direct access to the serializa-
tion and deserialization objects the server object uses to transform input and
output from and to XML. There is generally little or no need to explicitly set
these to new values.
options(optional new value) $server->options({compress_threshold => 10000});
Sets (or retrieves) the current server options as a hash-table reference. At present,
only one option is used within the
SOAP::Lite libraries themselves:
The value of this option is expected to be a numerical value. If set, and if the
Compress::Zlib library is available to use, messages whose size in bytes
exceeds this value are compressed for transmission. Both ends of the conver-
sation have to support this and have it enabled.
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Other options may be defined and passed around using this mechanism.
Note that setting the options using this accessor requires a full hash refer-
ence be passed. To set just one or a few values, retrieve the current refer-
ence value and use it to set the key(s).
dispatch_with(optional new value) $server->dispatch_with($new_table);
Represents one of two ways in which a SOAP::Server (or derived) object may
specify mappings of incoming requests to server-side subroutines or namespaces.
The value of the attribute is a hash-table reference. To set the attribute, you must
pass a new hash reference. The hash table’s keys are URI strings (literal URIs or
the potential values of the
SOAPAction header), and the corresponding values are
one of a class name or an object reference. Requests that come in for a URI
found in the table are routed to the specified class or through the specified
dispatch_to(optional list of new values) $server->dispatch_to($dir, 'Module',
This is the more traditional way to specify modules and packages for routing
requests. This is also an accessor, but it returns a list of values when called with
no arguments (rather than a single one). Each item in the list of values passed to
this method is expected to be one of four things:
Directory path
If the value is a directory path, all modules located in that path are available
for remote use.
Package name
When the value is a package name (without including a specific method
name), all routines within the package are available remotely.
Fully qualified method name
Alternately, when the value is a package-qualified name of a subroutine or
method, that specific routine is made available. This allows the server to
make selected methods available without opening the entire package.
Object reference
If the value is an object reference, the object itself routes the request.
The list of values held by the
dispatch_to table are compared only after the URI
mapping table from the
dispatch_with attribute has been consulted. If the
request’s URI or
SOAPAction header don’t map to a specific configuration, the
path specified by the action header (or in absence, the URI) is converted to a
package name and compared against this set of values.
objects_by_reference(optional list of new values) $server->objects_by_reference(qw(My::
This also returns a list of values when retrieving the current attribute value, as
opposed to a single value.

Get Programming Web Services with Perl now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.