在SoapClient中获取HTTP标头时出错 [英] Error fetching http headers in SoapClient

查看:271
本文介绍了在SoapClient中获取HTTP标头时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过远程主机上的https调用WS:远程端口,我得到:

I'm trying to invoke a WS over https on a remote host:remote port and I get:

获取http标头时出错

Error fetching http headers

使用PHP5 SoapClient;我可以通过执行$client->__getFunctions()来获取功能列表,但是当我调用$client->myFunction(...)时,总是会遇到此错误.

using the PHP5 SoapClient; I can get the list of functions by doing $client->__getFunctions() but when I call $client->myFunction(...) I always get this error.

我已经在google上搜索,发现在php.ini中增加default_socket_timeout应该可以解决该问题,但是没有用.

I've googled and found that increasing default_socket_timeout in php.ini should fix it, but it did not work.

有人可以建议我解决方案吗?

Can anyone suggest me a solution?

这是代码:

$wsdl="myWSDL";

$client = new SoapClient($wsdl,array('connection_timeout'=>5,'trace'=>true,'soap_version'=>SOAP_1_2));

var_dump($client->__getFunctions());

try {
    $response=$client->myFunction("1","2","3");
         } catch (SoapFault $fault) {
    var_dump($fault);
    }
}

总是以错误结束.

我该如何解决问题?

推荐答案

当SOAP响应超出default_socket_timeout值时,通常会出现此错误. (

This error is often seen when the default_socket_timeout value is exceeded for the SOAP response. (See this link.)

SoapClient构造函数的说明:connection_timeout选项用于定义连接到服务的超时值,而不是响应时间.

Note from the SoapClient constructor: the connection_timeout option is used for defining a timeout value for connecting to the service, not for the timeout for its response.

您可以像这样增加它:

ini_set('default_socket_timeout', 600); // or whatever new value you want

这应该告诉您超时是问题还是其他问题.请记住,您不应将其用作永久解决方案,而应在继续调查SOAP服务为何响应如此缓慢之前,先查看它是否消除了错误.如果该服务持续缓慢,则可能需要考虑脱机/批处理.

This should tell you if the timeout is the issue, or whether you have a different problem. Bear in mind that you should not use this as a permanent solution, but rather to see if it gets rid of the error before moving on to investigate why the SOAP service is responding so slowly. If the service is consistently this slow, you may have to consider offline/batch processing.

这篇关于在SoapClient中获取HTTP标头时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆