使用nusoap_client在php中读取soap响应

时间:2017-10-08 11:17:15

标签: php

如何阅读此soap响应并回显subid和points的值。 这是回复

    <?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:zuku">
    <SOAP-ENV:Body>
        <ns1:showloyaltypointsResponse xmlns:ns1="http://tempuri.org">
            <return xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:subpoints[1]">
                <item xsi:type="tns:subpoints">
                    <subid xsi:type="xsd:integer">618341</subid>
                    <points xsi:type="xsd:string">0</points>
                </item>
            </return>
        </ns1:showloyaltypointsResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

这是我的PHP代码

    $result = $client ->call('showloyaltypoints',array("subid" =>$subid,"username" =>"$username", "password" =>"$password"));

echo $client->response;

1 个答案:

答案 0 :(得分:0)

我首先通过将其转换为数组来找到解决方案。

https://stackoverflow.com/a/42311833/7042343