XML error parsing SOAP payload

Help
Ricardo
2012-10-04
2013-06-06
  • Ricardo
    Ricardo
    2012-10-04

    Hi. I'm new to nusoap and I'm dealing with a weird situation: the same server and client scripts run on Windows but do not run on Linux SuSE.

    Before posting a lot of information here  I'd like to know if someone else faced the same problem. Looking at the log messages issued by nusoap.php, I found that, in the Linux system, nusoap client gets response +request  as the response. It seems that the request was cached/buffered as part of the response. In other words:

    1. Client calls service via a XML request (508 bytes)
    2. Server delivers a XML response (a correct response) (744 bytes)
    3. Client receives wrong response which is a concatenation of XML request and XML response (1252 bytes).

    As the scheme used is http, it seems the response was stacked over the request and both sent back to the client as if they were a single response.

    If you need more information, please ask. I have nusoap log and a capture file (wireshark).

    Thanks,

    Ricardo

     
  • Ricardo
    Ricardo
    2012-10-04

    Well, I tried a way to circunvent the problem and it worked well but it is not a solution. I inserted a small piece of code in nusoap.php:

                   $this->debug('read body of length ' . strlen($data));
            //
            // beginning of circumvention
            $pos = strpos($data,"<?xml",5);
            if ($pos) {
                $data = substr($data,0,$pos);
                $this->debug("Ricardo: novo data");
                $this->debug($data);
            }
            // end of circumvention
            //
            $this->incoming_payload .= $data;
            $this->debug('received a total of '.strlen($this->incoming_payload).' bytes of data from server');
    

    This code was inserted in class soap_transport_http function get_response, which is executed by the client.

    What the code does is search for a second instance of a XML tree, which in this case contains the request to the service, and strip it away from the response. Then it works fine.

    It seems the problem is in the http server when it gets the response from the soap server and sends it to the client but I can't figure out when and why.

    Any help is welcome.

    Thanks,

    Ricardo