在迁移到一台新的OVH VPS机器后,我遇到了一个与API的WSDL连接问题,所以这可能是某种奇怪的配置错误。
我在SoapClient中使用的其他WSDL运行得很好,没有问题。我可以在地址上使用file_get_contents,但是当我使用SoapClient时,当我试图使用该API中的过程时,我会给出一个异常“无法连接到主机”。
有什么想法吗?我尝试了一些带有SSL选项的stream_context。最有趣的是,在另一个OVH VPS上工作得很好。
系统是带有PHP 5.6.19的Debian 8。
WSDL的地址在这里:https://api-test.paczkawruchu.pl/WebServicePwR/WebServicePwRTest.asmx?WSDL
发布于 2016-04-27 16:12:53
在咨询了WSDL提供者,并检查了两端的日志后,我们找到了答案。看起来PHP5.6有一些问题,您必须将参数更改为SOAP 1.2。这最终解决了问题。可以在这里找到解决方案,在第一条评论中:SOAP PHP fault parsing WSDL: failed to load external entity?
// options for ssl in php 5.6.5
$opts = array(
'ssl' => array('ciphers'=>'RC4-SHA', 'verify_peer'=>false, 'verify_peer_name'=>false)
);
// SOAP 1.2 client
$params = array ('encoding' => 'UTF-8', 'verifypeer' => false, 'verifyhost' => false, 'soap_version' => SOAP_1_2, 'trace' => 1, 'exceptions' => 1, "connection_timeout" => 180, 'stream_context' => stream_context_create($opts) );
$oSoapClient = new SoapClient ( $url . "?WSDL", $params );https://stackoverflow.com/questions/36868510
复制相似问题