Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Specifying SOAP::WSDL namespaces

by ptum (Priest)
on Mar 19, 2009 at 22:13 UTC ( #751896=perlquestion: print w/ replies, xml ) Need Help??
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, 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

Comment on Specifying SOAP::WSDL namespaces
Download Code
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
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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://751896]
Approved by olus
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (10)
As of 2014-09-22 18:34 GMT
Find Nodes?
    Voting Booth?

    How do you remember the number of days in each month?

    Results (198 votes), past polls