0
我有這個SOAP響應。解析soap xml文檔php
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<pkup:PickupPendingStatusResponse xmlns:pkup="http://www.ups.com/XMLSchema/XOLTWS/Pickup/v1.1">
<common:Response xmlns:common="http://www.ups.com/XMLSchema/XOLTWS/Common/v1.0">
<common:ResponseStatus>
<common:Code>1</common:Code>
<common:Description>Success</common:Description>
</common:ResponseStatus>
</common:Response>
<pkup:PendingStatus>
<pkup:PickupType>01</pkup:PickupType>
<pkup:ServiceDate>20141006</pkup:ServiceDate>
<pkup:PRN>2929AONCALL</pkup:PRN>
<pkup:OnCallStatusCode>001</pkup:OnCallStatusCode>
<pkup:PickupStatusMessage>Received at dispatch</pkup:PickupStatusMessage>
<pkup:BillingCode>01</pkup:BillingCode>
<pkup:ContactName>Shipping Mgr.</pkup:ContactName>
<pkup:ReferenceNumber>OnCallNextDayAir</pkup:ReferenceNumber>
</pkup:PendingStatus>
</pkup:PickupPendingStatusResponse>
</soapenv:Body>
我需要得到PickupPendingStatusResponse->Response->ResponseStatus->Description
。
我也想pkup:PendingStatus
到array
並能夠得到它的每個孩子的價值觀。
你如何目前獲取的反應如何?考慮SoapClient擴展以避免XML解析。否則,看看SimpleXML擴展 – Anthony 2014-10-06 19:50:49
我正在使用客戶端來獲取響應。 $ c =新的SoapClient($ wsdl)。 $ response = $ client-> getRates($ params) – Angelo 2014-10-06 19:52:56
然後我會認爲你的值是在'$ response-> ResponseStatus-> Description' – Anthony 2014-10-06 19:55:24