国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

php7 - php 解析SOAP的xml失敗
ringa_lee
ringa_lee 2017-05-16 13:14:49
0
2
2878
$xmlStr = <<<xml
<?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:Body>
        <client_insetResponse xmlns="http://120.26.103.193:2017/webservices/">
            <client_insetResult>0|</client_insetResult>
        </client_insetResponse>
    </soap:Body>
</soap:Envelope>
xml;
$xmlObj = simplexml_load_string($xmlStr);
var_dump($xmlObj);

上面代碼打印結(jié)果為空對(duì)象,說明解析失敗

ringa_lee
ringa_lee

ringa_lee

全部回復(fù)(2)
某草草

不能識(shí)別xmlns:soap,xmlns:xsi,xmlns:xsd。

可以把xmlns:soap改為xmlns-soap再處理。

僅有的幸福

soap的命名空間不被識(shí)別,參考下面代碼:

<?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:Body>
        <client_insetResponse xmlns="http://127.0.0.1/webservices/">
            <client_insetResult>0|</client_insetResult>
        </client_insetResponse>
    </soap:Body>
</soap:Envelope>
xml;
    
$xmlObj = simplexml_load_string($xmlStr);
$xmlObj->registerXPathNamespace('soap', 'http://schemas.xmlsoap.org/soap/envelope/');
$result = $xmlObj->xpath("soap:Body");

print_r($result);
最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板