How I Do parse SOAP response in PHP? [closed]

darrin230

New Member
SOAP XML:\[code\]<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <PaymentNotification xmlns="http://apilistener.envoyservices.com"> <payment> <uniqueReference>ESDEUR11039872</uniqueReference> <epacsReference>74348dc0-cbf0-df11-b725-001ec9e61285</epacsReference> <postingDate>2010-11-15T15:19:45</postingDate> <bankCurrency>EUR</bankCurrency> <bankAmount>1.00</bankAmount> <appliedCurrency>EUR</appliedCurrency> <appliedAmount>1.00</appliedAmount> <countryCode>ES</countryCode> <bankInformation>Sean Wood</bankInformation> <merchantReference>ESDEUR11039872</merchantReference> </payment> </PaymentNotification> </soap:Body></soap:Envelope>\[/code\]How to get 'payment' element?I try to parse (PHP)\[code\]$xml = simplexml_load_string($soap_response);$xml->registerXPathNamespace('soap', 'http://schemas.xmlsoap.org/soap/envelope/');foreach ($xml->xpath('//payment') as $item){ print_r($item);}\[/code\]Result is empty :(Any ideas how to parse it correct?
 
Back
Top