I’m writing a piece of PHP to consume a webservice.
I’m using something like :
$client = new SoapClient("http://somewebservicesmx?WSDL", array('trace' => 1));
$session = $client->SomeFuncion();
… and that’s working fine.
But this webservice return important data on the soap headers in the first call.
I want to read those values from the header, and I have tried with simplexml_load_string, which just returns empty.
Also tried witH:
$doc = new DOMDocument();
$doc->loadXML($soapLastResponse);
$value = $doc->getElementsByTagName("somenode");
$value = $value->item(0)->nodeValue;
Which seems to work, but I wonder if there is a “correct way” to achieve this.
I wonder if there is some function that can get me a value from the header without using DOMDocument.
I think this is what you are looking for?
It requires that
'trace'=>truein the construction of theSoapClienthttp://www.php.net/manual/en/soapclient.getlastresponseheaders.php
Edit: my confusion – recommend SimpleXMLElement