Posted on 2009-05-15 18:43:24-07 by mydimension
how to coerce namespaces into the right places
i'm trying to communicate with a .NET service and not having a whole lot of luck. I'm generating the following:
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" > <SOAP-ENV:Body> <InsertUpdateUser xmlns="http://tempuri.org/"> <token>foo</token> <user> <foo xmlns="">bar</foo> </user> </InsertUpdateUser> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
but it really needs to look something like this:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Body> <InsertUpdateUser xmlns="http://tempuri.org/"> <token>foo</token> <user xmlns:a="http://schemas.datacontract.org/2004/07/OrangeSoda.PopService.v2.Data" x +mlns:i="http://www.w3.org/2001/XMLSchema-instance"> <a:foo>bar</foo> </user> </InsertUpdateUser> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
the main difference being on the "user" type. the Elements/User.pm has the correct namespace. Types/User.pm does not have a namespace declared, and setting one manually has no effect. Is this a case where I need to write my own serializer (which I've tried a simple one with change) and if so, any tips on how to go about that? Thanks in advance.
Direct Responses: 10728 | Write a response
Posted on 2009-05-16 18:31:41-07 by mkutter in response to 10722
Re: how to coerce namespaces into the right places
Hi,
this is a bug - see https://rt.cpan.org/Ticket/Display.html?id=45037
Should be fixed in 2.00.10 uploaded to CPAN yesterday.
Martin
Direct Responses: 11097 | Write a response
Posted on 2009-06-30 18:49:06-07 by brianr in response to 10728
Re: how to coerce namespaces into the right places
Hi,

I think I'm still seeing this issue with the 2.00.10 release.

I'm using interfaces created by wsdl2perl.pl and when I snoop wire traffic, I find that many types which have a properly declared get_xmlns() sub, are serialized with an empty xmlns value.

See the entityId, uniqueKey, and tcn elements below:
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://sch +emas.xmlsoap.org/soap/envelope/" > <SOAP-ENV:Body> <updateRtms xmlns="http://server.example.com/provisioning/gateway"> <rtms> <entityId xmlns="">2</entityId> <uniqueKey xmlns="">5250</uniqueKey> <tcn xmlns="">0</tcn>

The object type for all of the xml elements contained within the <rtms> branch is MyTypes::RtmsConfig and the package contains:
package MyTypes::RtmsConfig; use strict; use warnings; __PACKAGE__->_set_element_form_qualified(0); sub get_xmlns { 'http://server.example.com/provisioning' };


I'm a bit new to this, but my expectation after reading through documentation on CPAN and various discussion forums is that I should be seeing:

<entityId xmlns="http://server.example.com/provisioning">


I hope I'm not too far off track here, as I'm new to using the SOAP::WSDL module. In my past and very limited experience with SOAP web services I've used SOAP::Lite. I'd really appreciate any pointers. Many Thanks!

-Brian
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.