[请益] 使用SoapClient错误但postman测试正常

楼主: sohumi (皮老板)   2017-08-11 17:02:01
原po使用一简易webservice,只需要丢入一xml资料,假设网址为
https://xxx.xxx.xxx/WebService.asmx?op=setData
使用postman直接将整串
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
中间略...
</soap:Body>
</soap:Envelope>
参数以raw的方式传出去,可以正常执行.
但若使用SoapClient
$url = "https://xxx.xxx.xxx/WebService.asmx?WSDL";
$xml = "<soap::Envelope.....中间略....";
$client = new SoapClient($url);
$result = $client->SetData($xml);
或是使用SimpleXMLElement
$xmlr = new SimpleXMLElement($xml);
$parameter = new stdClass();
$parameter->xml = $xmlr->asXML();
$result = $client->SetData($xmlr);
都会回传以下error message
Message: System.Web.Services.Protocols.SoapException:
服务器无法处理要求。
作者: mirae (国境之南)   2017-08-14 09:55:00
google php curl post raw data

Links booklink

Contact Us: admin [ a t ] ucptt.com