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

时间:2012-06-20 19:12:09

标签: php xml 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>

1 个答案:

答案 0 :(得分:3)

您可能希望查看SoapClient课程吗?这样可以避免麻烦。