SOAP::WSDL::Server::Mod_Perl2(3pm) | User Contributed Perl Documentation | SOAP::WSDL::Server::Mod_Perl2(3pm) |
NAME¶
SOAP::WSDL::Server::Mod_Perl2 - mod_perl based SOAP server using SOAP::WSDL
DESCRIPTION¶
Perl module providing a mod_perl2-based SOAP server using SOAP::WSDL
CONFIGURATION¶
Configuration is managed through the use of PerlSetVar directives. The following variables are available:
dispatch_to¶
Takes as a single argument the package name of the module which contains the methods which handle SOAP requests.
PerlSetVar dispatch_to "WebPackage::SOAPMethods"
soap_service¶
Takes as a single argument the package name of the Server module generated by SOAP::WSDL using
wsdl2perl --server file:///path/to/your/wsdl
By default, the name of the package is MyServer::$SERVICENAME::$PORTTYPE.
EXAMPLE: Given this sample WSDL which wsdl2perl was run against to generate perl packages:
<wsdl:portType name="WebServiceSoap"> [...] </wsdl:portType> [...] <wsdl:service name="WebService"> <wsdl:port name="WebServiceSoap" binding="tns:WebServiceSoap"> <soap:address location="http://www.example.com/WebService"/> </wsdl:port> </wsdl:service>
The following directive would be correct:
PerlSetVar soap_service "MyServer::WebService::WebServiceSoap"
transport_class [OPTIONAL]¶
Takes as a single argument the package name of the perl module containing a handle() method used to assemble the HTTP request which will be passed to the methods in your dispatch_to module (see above). A default handle() method is supplied in this module which should handle most common cases.
handle() is called with the following parameters:
$r - Apache::RequestRec object
EXAMPLES¶
The following snippet added to httpd.conf will enable a SOAP server at /WebService on your webserver:
<Location /WebService> SetHandler perl-script PerlResponseHandler SOAP::WSDL::Server::Mod_Perl2 PerlSetVar dispatch_to "WebPackage::SOAPMethods" PerlSetVar soap_service "MyServer::WebService::WebServiceSoap" </Location>
PERFORMANCE¶
On my machine, a simple SOAP server (the HelloWorld service from the examples) needs around 20s to process 300 requests to a CGI script implemented with SOAP::WSDL::Server::CGI, around 4.5s to the same CGI with mod_perl enabled, and around 3.2s with SOAP::WSDL::Server::Mod_Perl2. All these figures include the time for creating the request and parsing the response.
As general advice, using mod_perl is highly recommended in high-performance environments. Using SOAP::WSDL::Server::Mod_Perl2 yields an extra 20% speedup compared with mod_perl enabled CGI scripts - and it allows one to configure SOAP servers in the Apache config.
THREAD SAFETY¶
SOAP::WSDL uses Class::Std::Fast, which is not guaranteed to be threadsafe yet. Thread safety in Class::Std::Fast is dependent on whether
my $foo = $bar++;
is an atomic operation. I haven't found out yet.
A load test on a single CPU machine with 4 clients using the worker mpm did not reveal any threading issues - but that does not mean there are none.
CREDITS¶
Contributed (along with lots of other little improvements) by Noah Robin.
Thanks!
LICENSE AND COPYRIGHT¶
This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself
AUTHOR¶
Noah Robin <noah.robin gmail.com>
Based on SOAP::WSDL::Server::CGI, by Martin Kutter <martin.kutter fen-net.de>
REPOSITORY INFORMATION¶
$Rev: 583 $ $LastChangedBy: kutterma $ $Id: $ $HeadURL: $
2022-10-14 | perl v5.34.0 |