NAME
SOAP::Transport::HTTP::Server - Server side HTTP support for SOAP/Perl
SYNOPSIS
use SOAP::Transport::HTTP::Server;
DESCRIPTION
This class provides all the HTTP related smarts for a SOAP server, independent of what web browser it's attached to. It exposes a single function (that you'll never call, unless you're adapting SOAP/Perl to a new web server environment) that provides a set of function pointers for doing various things, like getting information about the request and sending response headers and content.
What *is* important to know about this class is what it expects of you if you want to handle SOAP requests. You must implement your class such that it can be created via new() with no arguments, and you must implement a single function:
handle_request(HeaderArray, Body, EnvelopeMaker)
The first two arguments are the input, an array of header objects (which may be empty if no headers were sent), a single Body object, and a third object to allow you to send a response.
See EnvelopeMaker to learn how to send a response (this is the same class used by a client to send the request, so if you know how to do that, you're cooking with gas).
HeaderArray and Body are today simply hash references, but in the future, they may be blessed object references.
If you want to customize this call-dispatching mechanism, you may pass a code reference for the OptionalDispatcher argument.
The OptionalDispatcher argument allows you to override the default dispatching behavior with your own code. This should reference a subroutine with the following signature:
custom_dispatcher(RequestedClass, HeaderArray, Body, EnvelopeMaker)
sub my_dispatcher { my ($requested_class, $headers, $body, $em) = @_;
# here's a simple example that converts the request
# into a method call (it doesn't deal with headers though)
my $method_name = $body->{soap_typename};
require $requested_class . '.pm';
my $retval = $requested_class->$method_name(%$body);
$em->set_body($body->{soap_typeuri}, $method_name . 'Response',
0, {return => $retval});
}
The above example handles each request by invoking a class-level method on the requested class.
DEPENDENCIES
SOAP::Defs SOAP::Parser SOAP::EnvelopeMaker
AUTHOR
Keith Brown
SEE ALSO
SOAP::Transport::HTTP::EnvelopeMaker SOAP::Transport::HTTP::Apache