Load the SOAP response into an DOMDocument
object:
$soapDoc = new DOMDocument();
$soapDoc->loadXML($soapResponse);
Prepare a DOMXPath
object for that document:
$xpath = new DOMXPath($soapDoc);
Register a prefix for the urn:it-progress-operate:ws_operate
namespace:
$xpath->registerNamespace('operate', 'urn:it-progress-operate:ws_operate');
Retrieve the payload node:
$path = "//operate:ttOutRow[operate:ParNam='XMLDocumentOut']/operate:ParVal";
$result = $xpath->query($path);
Save the payload XML:
$payloadXML = $result->item(0)->nodeValue;
Now that you have the payload XML string, go through the process again:
- Load it into a DOMDocument
- Prepare a DOMXpath object
- Register the
DTS
namespace - Use XPath to retrieve the value
It’s probably best to wrap the whole process into a function so you can re-use it.
1
solved How to parse xml response of soap php [closed]