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

Dear Monks,

Y have read as much as can about this problem and can't find a solution to it. Hope I can explain it clearly. I'm consuming a web service on .Net server. And they have the following request format for there service.

<?xml version="1.0" encoding="UTF-8"?> <soap:Envelope ...> <soap:Body> <getStamp xmlns="http://tempuri.org/"> ...XML FILE... </getStamp> </soap:Body> </soap:Envelope>

When I execute my code to consume the service SOAP::Lite generates the following request XML.

<?xml version="1.0" encoding="UTF-8"?> <soap:Envelope ...> <soap:Body> <getStamp xmlns="http://tempuri.org/"> <c-gensym2> ...XML FILE... </c-gensym2> </getStamp> </soap:Body> </soap:Envelope>

The section of code that produces the above XML is:

$client = SOAP::Lite -> proxy($endpoint); $client->soapversion('1.1'); $client->on_action(sub {"http://tempuri.org/getStamp"}); $client->autotype(0); $client->default_ns($namespace); $res = $client->getStamp($xml_file);

If I rewrite the call to

$method = SOAP::Data->name('getStamp')->attr({xmlns => $namespace}); $res = $client->call('getStamp', SOAP::Data->name('getStamp')->attr({xmnls => $namespace})->value($xml_ +file) );

Then the the request XML becomes this

<?xml version="1.0" encoding="UTF-8"?> <soap:Envelope ...> <soap:Body> <getStamp xmlns="http://tempuri.org/"> <getStamp xmlns="http://tempuri.org/"> ...XML FILE... </getStamp> </getStamp> </soap:Body> </soap:Envelope>

So. If I add a Data name, the gensym tag is removed but now I have an extra getStamp tag.

If I understand this, apparently SOAP::Lite enforces the use of a variable name after the Method name tag (if I interpret the XML correctly). If I do not explicitly set one it adds the gensym tag. In any case I end up with an extra tag all the time (generic or named)

The options I'm seeking help for are:

1) If there is a way to tell SOAP::Lite that I have a method call with no parameter name? or

2) A way to parse the soap envelope before sending it to the web service and remove those tags my self.

Replies are listed 'Best First'.
Re: Another SOAP::Lite remove gensym tag
by Anonymous Monk on May 23, 2011 at 23:40 UTC