'NUSOAP Client response is empty when I call SOAP endpoint on upgraded server

I am using NUSOAP client with a hard coded XML request to communicate with a Server to read a response from a Websphere server. I use nusoap_client->send to send the request.

$result = nusoap_client->send. Then SOAP response is obtained from $result. Perfect. Now I am trying to get a server response from an upgraded server (probably not using Websphere. Not sure). SOAP namespace is also changed and the response has some prefix.

I no longer get the SOAP response from $result (when I run strlen() I get zero size) . But I can call nusoap_client->responseData to get a response below. So I try to parse with simplexml_load_string on PHP5.x but it doesnt seem to parse and error message => syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING. Where could I be going wrong?

$stringer = <<<XML
<?xml version='1.0' encoding='ISO-8859-1'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
        <ser:getCarResourceResponse xmlns:ser="http://sos.joburg.com/webservice/ecare/services">
            <ser:GetCarResourceReply>
                <ser:resCode>10652981251</ser:resCode>
                <ser:departName>Ingolstadt</ser:departName>
                <ser:resStatus>4</ser:resStatus>
                <ser:statusDate>2022-05-09 09:24:50</ser:statusDate>
                <ser:isScheduled>0</ser:isScheduled>
                <ser:departStatus>0</ser:departStatus>
            </ser:GetCarResourceReply>
            <ser:ResultOfOperationReply>
                <ser:resultCode>0</ser:resultCode>
                <ser:resultMessage>Successful</ser:resultMessage>
            </ser:ResultOfOperationReply>
        </ser:getCarResourceResponse>
    </soapenv:Body>
</soapenv:Envelope>
    XML;
$log->logInfo(print_r(simplexml_load_string($stringer), 1));


Solution 1:[1]

As an update to this, I found the solution. Effectively, while I want to take an unstructured XML output and make it structured, it doesn't work like I thought.

It was necessary for me to take the single line of XML and format it as you see in the code markup. In the text file I lifted this from, I lifted a single line of XML which was not structured into multiple lines you see in stack overflow.

Thank you for your comments.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 codeprojector