8

I have been looking at this soap lite tutorial about generating service stubs using WSDL URL. However my data structures are more complex and have nested elements. The tutorial covers how to create complex structures using SOAP::Data. This seems very manual.

In other languages like Java it is very easy to stub the request object and use method calls to set the parameters. Is there a way to get a request object where I can then simply make method calls on the object to set the parameters rather then "manually" writing out the complex data structure using SOAP::Data as in the tutorial and SOAP::Data documentation?


Note: SOAP::Lite is not SOAP::WSDL. The SOAP::WSDL documentation states:

This module has a large number of known bugs and is not being actively developed. This 3.0 release is intended to update the module to pass tests on newer Perls. This is a service to existing applications already dependent on this module.

So the current supported modules are either SOAP::Lite or XML::Compile::SOAP.

G. Cito
  • 6,210
  • 3
  • 29
  • 42
Chris Doyle
  • 10,703
  • 2
  • 23
  • 42
  • 5
    As far as I've spent my nerves with SOAP::Lite it's related WSDL tools don't support complex data types. Frankly I find the whole thing rather underdocumented and with very limited examples. – Recct Dec 18 '14 at 10:38
  • I am surprised there isn't more support for this. With soap being a popular technology and Perl being great to whip up some quick code – Chris Doyle Dec 19 '14 at 10:56
  • 1
    That's what I thought! Even the company I was supposed to work with is using templated ready envelopes and stuff, everyone seems to boast about standards and compliancy but in reality everything is glue code and duct tape LOL – Recct Dec 19 '14 at 14:03
  • 2
    I have added an explanation to your question indicating why SOAP::WSDL is not appropriate. Have you tried Mark Overmeer's @mark-overmeer [`XML::Compile::SOAP`](https://metacpan.org/pod/XML::Compile::SOAP) – G. Cito Mar 10 '15 at 20:26
  • I'm not sure I understand your use of "stub" here. Do you mean creating a mock object for testing? Or are you looking for a way to simplify the code required to create requests? You can pass an array of objects to the constructor when dealing with complex data types. – G. Cito Mar 10 '15 at 20:49
  • yeah i ment simplyfyin the code, in java for example you can create a whole set of objects from the WSDL and then call the constructor or set methods to easily populate the data. – Chris Doyle Mar 14 '15 at 20:06
  • Since this is related to services, you might refer to my answer here: http://stackoverflow.com/questions/3143603/remote-function-call-using-soaplite/3144948#3144948 I had to work around SOAP::Lite's default croaking with more than one service. – Axeman Mar 25 '15 at 01:07

1 Answers1

1

WSDL is not actually part of the SOAP standard. WSDL was a separate standard that is commonly used with SOAP by Java/.Net et alia.

It looks like you want the Java "Point the IDE at the WSDL" method. This is no substitute for understanding the SOAP protocol. I highly recommend learning how to make manual SOAP calls and debug them - before you wind up in a situation where you have to do it on a deadline. I have known many Java 'Web Services' programmers who didn't even know how the protocol worked because the IDE wrote most of the infrastructure for them.

That said, the excellent XML::Compile::WSDL11 will probably do what you want.

arafeandur
  • 196
  • 1
  • 5