views:

79

answers:

1

I've been looking at ways to add a Perl-based SOAP server to our systems. Every time I look @ the SOAP tools in Perl I'm disappointed at how much more developer overhead seems to be required than folks in the VS.net world. (And I've been looking for a long time)

From reviewing other questions here, it looks like XML::Compile::SOAP seems to be the popular tool in recent times. I've worked out a way to get my code served as a service through it, but I also had to manually massage a .WSDL file I started with Pod::WSDL.

Is there a more direct approach that I'm not finding on CPAN or elsewhere? Pod::WSDL by default spits out rpc/encoded, which I understand is not the 'best' way anymore. The docs say that document/literal is not supported yet, and reading the source you can see parts of the code that do document/literal, but it doesn't work directly with XML::Compile::SOAP. Ideally I add a few annotations to our code in either POD or perl5 attributes, and push a button, and get WSDL that I can feed to the XML::Compile package.

Thanks in advance.

+1  A: 

As far as I know there isn't a better approach. At least for simple services.

I found that if I write my web services with an RPC mindset then SOAP::Lite is ludicrously easy to use.

  • Write a small perl program with subroutine in same file
  • Refactor in OO style, params & return values as perl objects.
  • Move subroutine to a separate module, test.
  • Move subroutine module to server. Copy data transfer object modules there too.
  • Add a SOAP::Lite dispatcher to server (a handful of lines).
  • Add a handful of lines of SOAP::Lite at the top of perl program (client). Done.

It is true that this uses RPC/Encoded style of SOAP which is out of favour. However if you add a little bit of POD markup, you can generate WSDL which (post massage) .Net clients can happily consume (At least, I tested with Mono and a 3rd party tested with MS C#)

As you say, Pod::WSDL's output does need massaging, I recall I had to fix one namespace as part of my build process.

The downside is that a lot of advanced SOAP-related XML processing is seemingly missing or isn't well integrated and that SOAP::Lite and Pod::WSDL seem a little moribund.

But for simple remote method invocation, passing Perl objects, I find it orders of magnitude simpler than the Java frameworks I've had a stab at. Your Mileage May Vary.

RedGrittyBrick