logo       
Google Custom Search
    AddThis Social Bookmark Button

Document/Literal problem with parseResponse()?: msg#00061

Subject: Document/Literal problem with parseResponse()?
Hi all -

I've been having a little trouble getting the nusoap client class to work with a .NET web service (postcodeanywhere.co.uk) which uses document/literal instead of rpc/encoded.

I began by following the "Using Document Style Messaging" section of Dietrich's chapter in "Professional Open Source Web Services".

The first problem was the use of the call() method. I'm not sure if that chapter is out of sync with the latest nusoap releases (the version I'm using declares itself to be NuSOAP/0.6.8 (1.76)). I was passing my XML variable into the call() method in an array:

        $client->call( 'FastAddress', array( $xml ) );

Which was returning a server error. It was also failing to form a valid SOAP request: the payload was empty.

So, after looking in nusoap.php I tried it without the array:

        $client->call( 'FastAddress', $xml );

This time it worked! I got the correct response from the server, and my request was as I expected. So I'm getting the correct data back from the server, and now I have to parse the response to extract my data.

Looking in nusoap.php I see the client member function "parseResponse", which "processes SOAP message returned from server". So I try calling parseResponse() like so:

    $k = $client->parseResponse( $client->getHeaders(),
                                 $client->responseData );

But, I get an error: "Response not of type text/xml".

Printing $client->responseData shows that it is indeed XML, so I printed $client->getHeaders() - but getHeaders() returns nothing. As getHeaders() just returns the responseHeaders class variable, it's clear that responseHeaders isn't being set.

So I look in the soapclient::send() function to see where responseHeaders is set, but couldn't see anything. So I added a line at line 5495 like so:

Before:
        $this->request = $http->outgoing_payload;
        $this->response = $http->incoming_payload;

After:
        $this->request = $http->outgoing_payload;
        $this->response = $http->incoming_payload;
        $this->responseHeaders = $http->incoming_headers;

But calling parseResponse as before still gives an error, and getHeaders() still returns nothing. So I figure something else is overwriting responseHeader in the parseResponse() function. Searching in parseResponse() I find the following line (at line 5562):

        // get SOAP headers
        $this->responseHeaders = $parser->getHeaders();

If I comment out this line, suddenly everything works as I would expect: parseResponse() now returns an associative array of the results from the server.


So: is this a problem with nusoap's handling of document/literal requests/responses, or am I being a complete idiot by forcing a square peg into a round hole? ;-)

Thanks for your time,

Henry.
--
Henry Todd
Systems Engineer
SpinVox Ltd



-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>