1

This is my SOAP response:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://localhost:8000/soap/index.php?wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
        <ns1:testMethodResponse>
            <return xsi:type="xsd:boolean">true</return>
        </ns1:testMethodResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

I'd like to return the true. How can I do this?

This is what I'm trying:

$xml = simplexml_load_string($res, NULL, NULL, "http://schemas.xmlsoap.org/soap/envelope/");
$ns = $xml->getNamespaces(true);
$soap = $xml->children($ns['SOAP-ENV']);
$res = $soap->Body->children($ns['ns1']);

foreach ($res->TestMethodResponse as $item) {
    echo $item->result.PHP_EOL;
}
f7n
  • 1,476
  • 3
  • 22
  • 42

0 Answers0