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! πŸ’–


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