http://qs321.pair.com?node_id=751896

ptum has asked for the wisdom of the Perl Monks concerning the following question:

I'm new to SOAP::WSDL, and am having some trouble specifying namespaces in the SOAP header. Does anyone have an example of how this is done?

(I'm trying to call an addObject method which has, as one of its arguments, a complex type prefixed in a second namespace, like this):

<addObject> <ns1:userid>1</ns1:userid> <ns1:userprofile> <ns2:first>Bob</ns2:first> <ns2:last>Smith</ns2:last> </ns1:userprofile> </addObject>

I can't seem to find a way to specify both the ns1 and ns2 namespaces, and the Axis2 server on the other end keeps complaining that it doesn't recognize the first parameter in the second namespace (in my example, 'ns2:first'): 'Unexpected subelement first'.

Also, one of my favorite features in SOAP::Lite is the +trace => 'all' option -- is there a way to turn trace on for SOAP::WSDL so that I can see the actual SOAP transactions that are sent and returned?

In general, I'm unhappy with the level of control that I seem to have lost, using the SOAP::WSDL class libraries generated by wsdl2perl.pl, probably because I don't really understand how they work. The getObject method (which has no complex parameters) worked great, but now that the addObject() method fails, I don't seem to have any tools to remedy the situation.

Even so, if there is any way I can avoid going back to rolling my own Type and Interface libraries, I would very much prefer to keep using SOAP::WSDL. This service that I need to connect to has a lot more types and methods than previous web services I have used.


No good deed goes unpunished. -- (attributed to) Oscar Wilde

Replies are listed 'Best First'.
Re: Specifying SOAP::WSDL namespaces
by olus (Curate) on Mar 19, 2009 at 23:28 UTC

    For tracing, I found this at the CPAN::Forum Trace?

      Hmmm. That looks like it will work, and do what I need. Thank you. :)

      No good deed goes unpunished. -- (attributed to) Oscar Wilde
Re: Specifying SOAP::WSDL namespaces
by Anonymous Monk on Mar 19, 2009 at 23:15 UTC
      Thank you. I'll try mucking around with the get_client() method some more.

      No good deed goes unpunished. -- (attributed to) Oscar Wilde