POE::Component::Server::SOAP is a Perl module that makes serving SOAP/1.1 requests a breeze in POE.
The hardest thing to understand in this module is the SOAP Body. That's it!
The standard way to use this module is to do this:
use POE;
use POE::Component::Server::SOAP;
POE::Component::Server::SOAP->new( ... );
POE::Session->create( ... );
POE::Kernel->run();
POE::Component::Server::SOAP is a bolt-on component that can publish event handlers via SOAP over HTTP. Currently, this module only supports SOAP/1.1 requests, work will be done in the future to support SOAP/1.2 requests. The HTTP server is done via POE::Component::Server::SimpleHTTP.
SYNOPSIS
use POE;
use POE::Component::Server::SOAP;
POE::Component::Server::SOAP->new(
'ALIAS' => 'MySOAP',
'ADDRESS' => 'localhost',
'PORT' => 32080,
'HOSTNAME' => 'MyHost.com',
);
POE::Session->create(
'inline_states' => {
'_start' => &setup_service,
'_stop' => &shutdown_service,
'Sum_Things' => &do_sum,
},
);
$poe_kernel->run;
exit 0;
sub setup_service {
my $kernel = $_[KERNEL];
$kernel->alias_set( 'MyServer' );
$kernel->post( 'MySOAP', 'ADDMETHOD', 'MyServer', 'Sum_Things' );
}
sub shutdown_service {
$_[KERNEL]->post( 'MySOAP', 'DELMETHOD', 'MyServer', 'Sum_Things' );
}
sub do_sum {
my $response = $_[ARG0];
my $params = $response->soapbody;
my $sum = 0;
while (my ($field, $value) = each(%$params)) {
$sum += $value;
}
# Fake an error
if ( $sum < 100 ) {
$_[KERNEL]->post( 'MySOAP', 'FAULT', $response, 'Client.Add.Error', 'The sum must be above 100' );
} else {
# Add the content
$response->content( "Thanks. Sum is: $sum" );
$_[KERNEL]->post( 'MySOAP', 'DONE', $response );
}
}
Product's homepage
Requirements:
· Perl