我目前从SOAP调用返回。
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<ns:getMakeResponse xmlns:ns="http://ws.fds.com">
<ns:return>
<ResponseCode>000</ResponseCode>
<ResponseDescription>No Errors</ResponseDescription>
<MakeReturn>
<Make>JEEP</Make>
<MakeDescription>JEEP</MakeDescription>
</MakeReturn>
<MakeReturn>
<Make>CHRY</Make>
<MakeDescription>CHRYSLER</MakeDescription>
</MakeReturn>
<ns:return>
</ns:getMakeResponse>
</soapenv:Body>
</soapenv:Envelope>
如何将其转换为如下所示的数组或类似的数据?
Array
(
[id] => 1
[responsecode] => 000
[responsedescription] => No Errors
[0] => Array
(
[make] => JEEP
[makedescription] => JEEP
)
[1] => Array
(
[make] => CHRY
[makedescription] => CHRYSLER
)
)
感谢您提供的任何帮助!
答案 0 :(得分:3)
答案 1 :(得分:0)
如果您使用本机PHP SoapClient,则输出已被转储到PHP对象...
$client = new SoapClient('...wsAvailability.asmx?wsdl', array('trace' => true, 'exceptions' => 0));
$output = $client->GetWhateverMethod($input);
$xml = $client->__getLastResponse();
查看$ output对象,它应该包含你想要的大部分内容......