This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Creating New Transport Modules
applications built using the class. The sample TCP server’s handle method acted as
an infinite loop, where the POP3
handle was wrapped in an explicit loop construct.
It is within the
handle method that the server object is expected to retrieve one or
more requests, using the protocol it is written to support. In many cases, once the
request has been read and stored into memory, it is usually directly usable by the
handle method of the superclass. Many of the derived server classes simply call the
SOAP::Server handle method once they’ve read the request:
my $response = $self->SUPER::handle($request);
Once the response is given back, it is then up to the new code to properly transmit it
back to the client. This is assuming that a client response is part of the design; the
POP3 server doesn’t send a client reply because there is no client connection avail-
able to it.
Other server methods
There are other methods within SOAP::Server that may be overloaded, not to men-
tion hooks such as
on_dispatch. The documentation for SOAP::Lite and Appendix B
of this book may be of help in such tasks.
Writing a Client Transport
Writing an actual new client transport module is trickier than writing a server com-
WishListCustomer::Client class developed earlier in this chapter isn’t an
actual transport class. It was a subclass of
SOAP::Lite itself, designed to interject a
consistent header element into every outgoing request.
A class intended for use as a client’s transport object is very different.
Naming the client class
The name of a client class is defined by the protocol itself and the transport class it is
expected to work with. All the client classes provided by
SOAP::Lite have names that
fit the following form:
By default, SOAP::Lite objects have a transport object instantiated from the SOAP::
class. Using Jabber as an example, the class name becomes:
SOAP::Lite attempts to load protocol code using the transport object’s class name
and the uppercased protocol string. Keeping with the ongoing example, this means
that when a client tries to set a proxy with a protocol specification of
SOAP::Lite (specifically, the proxy method of SOAP::Transport) tries to load a pack-
SOAP::Transport::JABBER, and expects a client class called SOAP::