Как прочитать ответ SOAP Envelope с помощью PHP

Как мне прочитать error_code из этого конверта ответа SOAP? Моя версия PHP: 5.2.0.

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
 <soap:Body>
  <Response xmlns="http://xxx.gateway.xxx.abcd.com">
   <return>
      <transaction_id>1234567</transaction_id>
      <error_code>109</error_code>    
   </return>
  </Response>
 </soap:Body>
</soap:Envelope>

Мне просто нужно прочитать значение тега error_code. Здесь значение: 109

Я использую нусоап. Я использовал приведенный ниже код, но не работал должным образом:

$response=htmlspecialchars($client->response, ENT_QUOTES);
$xml = simplexml_load_string($response); 
$ns = $xml->getNamespaces(true); 
$soap = $xml->children($ns['soap']); 
$error_code = $soap->body->children($ns['error_code']);

person riad    schedule 13.11.2011    source источник
comment
stackoverflow.com/q/1470579/367456   -  person hakre    schedule 13.11.2011