简体   繁体   English

一个WSDL API出现SoapClient“无法连接到主机”异常

[英]SoapClient “Could not connect to host” exception with one WSDL API

I have a problem with one WSDL connection with API, after moving to a new OVH VPS machine, so it's maybe some kind of strange misconfiguration. 在移至新的OVH VPS计算机之后,我与API的WSDL连接出现问题,因此这可能是某种奇怪的错误配置。

Other WSDL that I use with SoapClient, work fine, without problems. 我与SoapClient一起使用的其他WSDL工作正常,没有问题。 I'm able to use file_get_contents on the address, but when I use SoapClient I gives a exception "Could not connect to host", when trying to use a procedure from that API. 我可以在该地址上使用file_get_contents ,但是当我尝试使用该API中的过程时,使用SoapClient会给出异常“无法连接到主机”。

Any ideas? 有任何想法吗? I've tried some stream_context with some SSL options. 我尝试了一些带有SSL选项的stream_context What's the funniest, on the other OVH VPS is working fine. 最有趣的是,其他OVH VPS正常工作。

System is Debian 8 with PHP 5.6.19 onboard. 系统是Debian 8,板载PHP 5.6.19。

Addresss of the WSDL is here: https://api-test.paczkawruchu.pl/WebServicePwR/WebServicePwRTest.asmx?WSDL WSDL的地址在这里: https ://api-test.paczkawruchu.pl/WebServicePwR/WebServicePwRTest.asmx?WSDL

After consultation with WSDL provider, and checking logs on both sides, we found the anwser. 在与WSDL提供者协商之后,并检查了双方的日志,我们找到了anwser。 It looks like PHP 5.6 have some problems, and you have to change parameters to SOAP 1.2. 看起来PHP 5.6有一些问题,您必须将参数更改为SOAP 1.2。 This resolved finally the problem. 这终于解决了问题。 Resolution could be found here, in first comment: SOAP PHP fault parsing WSDL: failed to load external entity? 在这里的第一个评论中可以找到解决方案: SOAP PHP错误解析WSDL:无法加载外部实体?

// 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 );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM