使用 SimpleXML 将 SOAP 响应转换为关联数组


Convert SOAP response to associative array using SimpleXML

如何使用SimpleXML将这样的SOAP响应转换为php数组?

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header>
    <eWAYHeader xmlns="http://www.eway.com.au/gateway/rebill/manageRebill">
      <eWAYCustomerID>9******5</eWAYCustomerID>
      <Username>ac****@si****.com.sand</Username>
      <Password>*******</Password>
    </eWAYHeader>
  </soap:Header>
  <soap:Body>
    <CreateRebillCustomerResponse xmlns="http://www.eway.com.au/gateway/rebill/manageRebill">
      <CreateRebillCustomerResult>
        <Result>Success</Result>
        <ErrorSeverity />
        <ErrorDetails />
        <RebillCustomerID>60066328</RebillCustomerID>
      </CreateRebillCustomerResult>
    </CreateRebillCustomerResponse>
  </soap:Body>
</soap:Envelope>

你可能想看看SoapClient类呢?它将节省大量麻烦。