Posted on 2009-08-05 20:47:30-07 by agwright
SOAP::Lite not creating tags correctly?
I'm trying to write a SOAP client with WS security to be implemented on a CGI page. I am able to create a client using the ->service("wsdlURL") method, and my request gets to the server, but it returns a 404 error. I know from reading the log on the server side that my request is getting to the server, but it is failing to correctly map to an endpoint. I can see the raw XML from the request, and I noticed that in the Body of the request, the format is:

<SOAP-ENV:Body>
<namespace:myRemoteFunctionName>
... parameters ...
<namepsace:/myRemoteFunctionName>
</SOAP-ENV:Body>

I already have two working methods of sending SOAP requests: one through soapUI, and the other through a PHP client I got working. I looked at the raw XML of successful requests from both of these, and I saw:

<SOAP-ENV:Body>
<namespace:myRemoteFunctionNameRequest>
... parameters ...
<namepsace:/myRemoteFunctionNameRequest>
</SOAP-ENV:Body>

This is the only non-trivial difference I can find between the XML generated by Perl and the other two clients. Is it possible that this is what is causing my problem? Here's my code for calling the function, where $Security is my WS-Security Header (some code irrelevant to this issue is omitted):
my $WSDL = "--- the URL of the WSDL ---"; my $SoapClient = SOAP::Lite->service($WSDL); my $serializer = $SoapClient->serializer(); $serializer->register_ns("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext +-1.0.xsd", "wsse" ); $serializer->register_ns("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utilit +y-1.0.xsd", "wsu" ); $serializer->envprefix("SOAP-ENV"); my $lineName = SOAP::Data->name("lineName")->value("Line1")->type(""); my $runName = SOAP::Data->name("runName")->value("Run1")->type(""); $SoapClient->findSchedule($Security, $lineName, $runName);
If this tag issue is my problem, which I believe it must be, how might I change my code to get SOAP::Lite to add the word "Request" after the function name in the tag? This seems to be done automatically by PHP and soapUI, so why doesn't SOAP::Lite do it? Thanks!
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.