| [ Team LiB ] |
|
Recipe 18.13 Writing a SOAP Server18.13.1 ProblemYou want to write a web service where SOAP is the transport. 18.13.2 SolutionUse the SOAP-Lite distribution from CPAN. Your server can be either standalone: use SOAP::Transport::HTTP;
$daemon = SOAP::Transport::HTTP::Daemon
->new(LocalPort => $PORT)
->dispatch_to('ClassName')
->handle( );
or a CGI script: use SOAP::Transport::HTTP;
$daemon = SOAP::Transport::HTTP::CGI
->dispatch_to('ClassName')
->handle( );
In both cases, the only methods that SOAP clients are permitted to invoke are those in the classes named in the argument to dispatch_to (those classes will be required if not already loaded): package ClassName;
sub handler {
my ($class, $arg_hash_ref) = @_;
# ...
}
18.13.3 DiscussionThe SOAP-Lite toolkit contains SOAP and XML-RPC modules. Writing a SOAP service is similar to writing an XML-RPC service. Control method dispatch in SOAP as in XML-RPC. See Recipe 18.11 for details. 18.13.4 See Also |
| [ Team LiB ] |
|