SOAP::...d_Perl2(3pm)
π NAME π
ok so bestie, welcome to SOAP::WSDL::Server::Mod_Perl2 β it's the mod_perl based SOAP server, and it runs on SOAP::WSDL β¨
(this lil page lives in the User Contributed Perl Documentation section, 3pm girlies rise up π«Ά)
πΈ DESCRIPTION πΈ
It's a Perl module, right? And what it does is give you a mod_perl2-based SOAP server built on top of SOAP::WSDL. That's the whole vibe. Serving SOAP. Iconically. π
β¨ CONFIGURATION β¨
So the way you configure all of this is through PerlSetVar directives. That's the whole system, no cap. And here's the roster of variables you can set:
π dispatch_to
Okay so this one takes a single argument: the package name of the module that has all the methods actually handling your SOAP requests. Like, the brains of the operation.
PerlSetVar dispatch_to "WebPackage::SOAPMethods"
π¦ soap_service
This one also takes a single argument: the package name of the Server module that SOAP::WSDL generated for you, using:
wsdl2perl --server file:///path/to/your/wsdl
And if you don't feel like specifying? The default package name is MyServer::$SERVICENAME::$PORTTYPE. Cute, right? Now let's look at how you'd actually figure that out.
EXAMPLE: so imagine the WSDL that wsdl2perl was run against to generate the perl packages looked like this:
<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>
Then the correct directive would be this, exactly:
PerlSetVar soap_service "MyServer::WebService::WebServiceSoap"
Periodt. π
π transport_class [OPTIONAL]
So again, single argument: package name of the perl module holding a handle() method, and that method is what assembles the HTTP request that gets passed off to the methods in your dispatch_to module (yeah, the one from above βοΈ). Don't stress though, because a default handle() method ships right in this module and it should cover most common cases. We love a sensible default π«Ά
And handle() gets called with these parameters:
$r - Apache::RequestRec object
π§ EXAMPLES π§
Okay so here's the moment you've been waiting for. Drop this snippet into your httpd.conf and boom β you've got a SOAP server chillin' 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>
slay π
π₯ PERFORMANCE π₯
Okay numbers time, and ngl these are kind of the flex of the whole page. On my machine, a simple SOAP server (the HelloWorld service from the examples, obviously) needs:
- around 20s</bold> to process 300 requests to a CGI script implemented with
SOAP::WSDL::Server::CGI - around 4.5s to the same CGI, but with mod_perl enabled
- around 3.2s with
SOAP::WSDL::Server::Mod_Perl2
And important: all of those figures include the time for creating the request and parsing the response. Full package deal. β¨
So general advice, and this is fr fr: if you're in a high-performance environment, using mod_perl is highly recommended. And going with SOAP::WSDL::Server::Mod_Perl2 gets you an extra 20% speedup compared with mod_perl enabled CGI scripts β plus it lets you configure SOAP servers right in the Apache config. Double win, main character energy π
π THREAD SAFETY π
Okay bestie this is the part where we get honest. SOAP::WSDL uses Class::Std::Fast, and that is not guaranteed to be threadsafe yet. The thread safety of Class::Std::Fast hinges on whether this:
my $foo = $bar++;
is an atomic operation. And straight up? I haven't found out yet. π
Now, there was a load test β single CPU machine, 4 clients, using the worker mpm β and it did not reveal any threading issues.
β οΈ but that does not mean there are none. Do not take that as a promise. It's giving "probably fine, no guarantees" π
π 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: $
and that's a wrap, bestie π«Ά this was perl v5.36.0, dated 2022-10-14, and yes the title up top really does get truncated to SOAP::...d_Perl2(3pm) β the man page girlies abbreviate, we still understood it π
β¨
π¦ where this page comes from
- ubuntu noble: libsoap-wsdl-perl 3.004-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libsoap-wsdl-perl 3.004-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libsoap-wsdl-perl 3.004-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms