title: Processing SOAP response
body: <p>I am attempting to process a SOAP response from First Data's Global Gateway. I've used SoapClient before, but there is no wsdl - and the company says they do not supply one. </p>
  
  <p>I've tried various other approaches such as SimpleXMLElement based on examples found here and in the PHP manual but I can't get anything to work. I suspect namespaces are part of my problem. Can anyone suggest an approach or point me to a similar example - my Google efforts have been fruitless to date.</p>
  
  <p>Using PHP 5.</p>
  
  <p>Partial SOAP Response (with all the HTML header stuff that precedes it stripped off) looks like this:</p>
  
  <pre><code>&lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;
  
  &lt;SOAP-ENV:Header/&gt;
  
  &lt;SOAP-ENV:Body&gt;
  
  &lt;fdggwsapi:FDGGWSApiOrderResponse xmlns:fdggwsapi="http://secure.linkpt.net/fdggwsapi/schemas_us/fdggwsapi"&gt;
  
  &lt;fdggwsapi:CommercialServiceProvider/&gt;
  
  &lt;fdggwsapi:TransactionTime&gt;Thu Nov 29 17:03:18 2012&lt;/fdggwsapi:TransactionTime&gt;
  
  &lt;fdggwsapi:TransactionID/&gt;
  
  &lt;fdggwsapi:ProcessorReferenceNumber/&gt;
  
  &lt;fdggwsapi:ProcessorResponseMessage/&gt;
  
  &lt;fdggwsapi:ErrorMessage&gt;SGS-005005: Duplicate transaction.&lt;/fdggwsapi:ErrorMessage&gt;
  
  &lt;fdggwsapi:OrderId&gt;A-e833606a-5197-45d6-b990-81e52df41274&lt;/fdggwsapi:OrderId&gt;
  ...
  
  &lt;snip&gt;
  </code></pre>
  
  <p>I also need to be able to determine if a SOAP fault was signalled. XML for that looks like this:</p>
  
  <pre><code>&lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;
  &lt;SOAP-ENV:Header/&gt;
  &lt;SOAP-ENV:Body&gt;
  &lt;SOAP-ENV:FaultX&gt;
  &lt;faultcode&gt;SOAP-ENV:Client&lt;/faultcode&gt;
  &lt;faultstring xml:lang="en"&gt;MerchantException&lt;/faultstring&gt;
  &lt;detail&gt;
  cvc-pattern-valid: Value '9999185.00' is not facet-valid with respect to pattern '([1-9]([0-9]{0,3}))?[0-9](\.[0-9]{1,2})?' for type '#AnonType_ChargeTotalAmount'.
  cvc-type.3.1.3: The value '9999185.00' of element 'v1:ChargeTotal' is not valid.
  &lt;/detail&gt;
  &lt;/SOAP-ENV:FaultX&gt;
  &lt;/SOAP-ENV:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>Using Mr. Code's answer I have been able to retrieve the data from the non-fault responses. But I need to determine what type of packet I am dealing with and extract data from both types. It would be so  much easier if only they would supply a wsdl!</p>