Scroll to navigation

SOAP::WSDL::Server::Mod_Perl2(3pm) User Contributed Perl Documentation SOAP::WSDL::Server::Mod_Perl2(3pm)


SOAP::WSDL::Server::Mod_Perl2 - mod_perl based SOAP server using SOAP::WSDL


Perl module providing a mod_perl2-based SOAP server using SOAP::WSDL


Configuration is managed through the use of PerlSetVar directives. The following variables are available:


Takes as a single argument the package name of the module which contains the methods which handle SOAP requests.

 PerlSetVar dispatch_to "WebPackage::SOAPMethods"


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:service name="WebService">
        <wsdl:port name="WebServiceSoap" binding="tns:WebServiceSoap">
            <soap:address location=""/>

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


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"


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.


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.


Contributed (along with lots of other little improvements) by Noah Robin.



This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself


Noah Robin <noah.robin>

Based on SOAP::WSDL::Server::CGI, by Martin Kutter <martin.kutter>


 $Rev: 583 $
 $LastChangedBy: kutterma $
 $Id: $
 $HeadURL: $
2020-01-20 perl v5.30.0