我有以下字符串:
$string='<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bac="http://backupbank.com/"> <soapenv:Header/> <soapenv:Body>
<bac:CreateUser>
<bac:request>
<!--Optional:-->
<bac:username>anandneema</bac:username>
<bac:product>Workstation</bac:product>
<bac:credentials>
<bac:server>serveripaddress</bac:server>
<bac:user>username</bac:user>
<bac:password>password</bac:password>
</bac:credentials>
</bac:request>
</bac:CreateUser> </soapenv:Body> </soapenv:Envelope>';
$xmldata=simplexml_load_string($string);
echo "<pre>"; print_r($xmldata);
它没有解析数据。
但是当我使用时:
$string='<soapenv:Envelope> <soapenv:Header/> <soapenv:Body>
<bac:CreateUser>
<bac:request>
<!--Optional:-->
<bac:username>anandneema</bac:username>
<bac:product>Workstation</bac:product>
<bac:credentials>
<bac:server>serveripaddress</bac:server>
<bac:user>username</bac:user>
<bac:password>password</bac:password>
</bac:credentials>
</bac:request>
</bac:CreateUser> </soapenv:Body> </soapenv:Envelope>';
$xmldata=simplexml_load_string($string); echo "<pre>"; print_r($xmldata);
实际上,当我删除属性时:xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:bac="http://backupbank.com/"
然后它解析数据
任何人都可以告诉我这个问题可能是什么?
答案 0 :(得分:0)
对此没有太多想法但是尝试通过将xml正确格式化为字符串来调用服务然后使用CURL可能就像在这个问题中