This is a prelude to a series on working with SOAP Requests using Perl. For the past 3 months I have been working on a Perl API for CyberSource’s Simple Order API which uses SOAP (I should note, that although I believe most of the API is now stable some area’s still need work, and thus I don’t expect it to reach 1.0.0 anytime soon).
First I used SOAP::Lite to do my requests, but I found it confusing to construct the requests that I needed to make. I even discovered a bug that lead to the current ( 0.714 ) release of SOAP::Lite.
Next I started using SOAP::Data::Builder to make it easier to build my SOAP::Lite requests. This was good, but frustrating that I had to add my data in a specific order. Finally I came upon XML::Compile::SOAP. A glance at it’s API which used a hash to build requests seemed much better. however, it took me a few weeks and some help from Mark Overmeer (the author) and an update to XML::Compile::SOAP::WSS to get it to work.
If you’re planning on starting a new project that requires SOAP I definitely recommend using
XML::Compile::SOAP if you have a .wsdl
and a .xsd
to work with.
I will be covering all 3 of these methods in Parts 1, 2 and 3 of the series.
To get started we’ll need a SOAP Server since I haven’t been able to find any reliable public services. To do this you
can install XML::Compile::SOAP::Daemon (which probably could use some Plack/PSGI love ). You’ll want to grab a
copy of the namesservice example that is in XML::Compile::SOAP::Daemon, I have provided a
patched copy in a gist. Once you’ve done that you can do perl server.pl
. Now you should have a Server
running on http://localhost:8877/ which we can use for testing our client examples.
Please be advised, these tutorials will not be explain XML, XSD, WSDL, or SOAP, but simply the Perl interfaces.
Update: Here is Part 1 ( SOAP::Lite )