【发布时间】:2019-02-03 13:52:55
【问题描述】:
我是 php 新手,如何解析来自 soap xml 的 2 个不同响应?
响应 1
'<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:MobileAgentAPI="urn:openApi">
<SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<MobileAgentAPI:invokeResponse>
<SOAP-ENV:BodySOAP-ENV:Body>
<values xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="MobileAgentAPI:SoapMapValue[13]">
<item>
<name>amount</name>
<singleValue>5000</singleValue>
</item>
<item>
<name>balance</name>
<singleValue>12210000</singleValue>
</item>
<item>
<name>lastBalance</name>
<singleValue>12215000</singleValue>
</item>
<item>
<name>returnCode</name>
<singleValue>00</singleValue>
</item>
<item>
响应 2
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:MobileAgentAPI="urn:openApi"><SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><MobileAgentAPI:invokeResponse><invokeReturn><values xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="MobileAgentAPI:SoapMapValue[6]"><item><name>balance</name><singleValue>15420000</singleValue></item><item><name>returnCode</name><singleValue>01</singleValue></item><item><name>transactionStatus</name><singleValue>02</singleValue></item><item><name>errorCode</name><singleValue>324</singleValue></item><item><name>errorDescription</name><singleValue>(324) Maaf, transaksi pada 01/10/18 06:00 gagal. Nomor tujuan tidak terdaftar. =</singleValue></item><item><name>tran
我尝试使用 DOM 文档,但如果我们有 2 个响应,结果是错误
【问题讨论】:
-
请提问。你说的没有道理。完成您的问题或将其删除。