Php 无法连接到主机soap异常
我在Php 无法连接到主机soap异常,php,soap,wsdl,Php,Soap,Wsdl,我在php脚本中使用SOAP从linuxcentos6服务器调用web服务。本周,我从soapCall方法中得到无法连接到主机错误。当然,此异常并非总是发生,但我在大多数情况下都会看到此异常,例如,如果我调用soapCall5次,则此错误会发生3次。我的代码如下所示,几个月来我根本没有更改过它,但最近它大部分时间都出现了这个错误 $wsdl="http://x.x.x.x:x/gw/services/Service?wsdl"; //Set key as HTTP Header $aHTTP
php
脚本中使用SOAP
从linuxcentos6
服务器调用web服务。本周,我从soapCall方法中得到无法连接到主机错误。当然,此异常并非总是发生,但我在大多数情况下都会看到此异常,例如,如果我调用soapCall
5次,则此错误会发生3次。我的代码如下所示,几个月来我根本没有更改过它,但最近它大部分时间都出现了这个错误
$wsdl="http://x.x.x.x:x/gw/services/Service?wsdl";
//Set key as HTTP Header
$aHTTP['http']['header'] = "key:" .$key ."\r\n";
$context = stream_context_create($aHTTP);
try
{
$client = new SoapClient($wsdl,array("soap_version" => SOAP_1_2,'trace' => 1,"stream_context" => $context));
}
catch(Exception $e)
{
return "something";
}
//I make $parametrs
try
{
$res = $client->__soapCall("send",array($parametrs));
}
catch(Exception $e)
{
print_r($e->getMessage()); //Most of the time it prints could not connect to host
}
我在这里已经阅读了有关问题的大部分答案,但我的问题还没有解决。我还补充说
ini_set("soap.wsdl_cache_enabled", "0");
ini_set("soap.wsdl_cache_ttl","0");
但一切都没有改变。我搜索了很多关于原因的信息,找到了一些关于SSL的信息,但我没有找到确切的解决方案。
必须提到的是,我可以在浏览器中看到wsdl
URL,并且它是ping