Yir*_*her 8 php wsdl soap-client
使用PHP SoapClient,我在https://webservices-test.ede.de:9443/ibis/ws/WS_EXT_ELC?wsdl上调用WSDL,然后得到以下xml响应(如下所示$soapclient->__last_response)
<?xml version='1.0' encoding='UTF-8'?><soap:Envelope xmlns:ede="http://ede.de/webservices" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Body><Response action="ELC" requestId="1" version="1.0"><created>2017-09-04T16:04:46.556+02:00</created><StatusInformation>OK</StatusInformation><StatusCode>0</StatusCode><Payload><SalesOrderSimulateConfirmation><Items><Item><ID>10</ID><ProductID>0003062700050</ProductID><Price>2.970</Price><PositionPrice>2.970</PositionPrice><PriceUnit>1</PriceUnit><QuantityUnit>ST</QuantityUnit><QuantityAvailable>1</QuantityAvailable><QuantityProfile>1</QuantityProfile><Currency>EUR</Currency><Services /><Schedules>Geplante Liefertermine: 1 ST in KW 36.2017;</Schedules><Remark /><DangerMaterial /></Item></Items></SalesOrderSimulateConfirmation></Payload></Response></soap:Body></soap:Envelope>
Run Code Online (Sandbox Code Playgroud)
尽管如此,还是要求$soapclient->simulateOrder()回报null.
如何让PHP SoapClient返回一个对象而不是null?
注意:我用于soap调用的xml是通过覆盖手动生成的SoapClient::__doRequest().soap调用的代码如下所示:
$soapClient = new SoapClient('https://webservices-test.ede.de:9443/ibis/ws/WS_EXT_ELC?wsdl', array(
'cache_wsdl' => WSDL_CACHE_NONE,
'trace' => true,
'exceptions' => true,
'soap_version' => SOAP_1_2,
'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
'login' => '------', // cannot post here for security purposes
'password' => '-----', // cannot post here for security purposes
'stream_context' => (
stream_context_create(array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
))
));
$result = $soapClient->simulateOrder();
Run Code Online (Sandbox Code Playgroud)
没有抛出异常,但是$result是null
问题是 SSL 设置,当我尝试在我的服务器上调用您的代码时抛出的错误如下:
致命错误:未捕获的 SoapFault 异常:[WSDL] SOAP-错误:正在解析 WSDL:无法从“ https://webservices-test.ede.de:9443/ibis/ws/WS_EXT_ELC?wsdl ”加载:无法加载外部/home/repojarilo/public_html/sc.php:22 中的实体“ https://webservices-test.ede.de:9443/ibis/ws/WS_EXT_ELC?wsdl ” 堆栈跟踪:#0 /home/repojarilo/public_html/sc .php(22): SoapClient->SoapClient(' https://webserv ...', Array) #1 {main} 在第 22 行抛出 ...
我假设您正在尝试让代码与请求中的 SSL 数组中所示的自签名证书一起使用,但是看起来 SoapClient 并没有注意到它并抛出错误。
所以我的解决方案是购买 SSL(现在非常便宜,尝试诸如 namecheap 等网站...)或使用https://letsencrypt.org/之类的东西来获取允许您的肥皂客户端工作的 SSL正确。
最后我注意到一个拼写错误,在你的代码中最后一行之前你));应该读作)));.
科达
| 归档时间: |
|
| 查看次数: |
899 次 |
| 最近记录: |