XMLRPC Zend_Http_Client_Adapter_Exception',消息“读取在10秒后超时” [英] XMLRPC Zend_Http_Client_Adapter_Exception' with message 'Read timed out after 10 seconds

查看:69
本文介绍了XMLRPC Zend_Http_Client_Adapter_Exception',消息“读取在10秒后超时”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我到处都有Google搜索,但是没有人发布解决方案,他们都说要在配置中设置超时时间,但是您该怎么做呢?

I've Googled everywhere but no one has posted a solution, they all say to set the timeout in the config but how do you do this?

如何做我是从XMLRPC客户端还是从服务器重置/覆盖此设置?

How do I reset/override this setting from my XMLRPC client or server?

这是我要尝试的内容:

$server = new Zend_XmlRpc_Client('http://127.0.0.1/xmlrpc');
$client = $server->getProxy(); 

// Increasing the timeout
$client->setConfig(array('timeout'=>30));

这是错误:

Fatal error: Uncaught exception 'Zend_XmlRpc_Client_FaultException' 
with message 'Method "setConfig" does not exist' 
in /usr/share/php/libzend-framework-php/Zend/XmlRpc/Client.php:370

尝试通过arg:

$server = new Zend_XmlRpc_Client('http://127.0.0.1/xmlrpc', array('timeout'=>30));

这是错误:

Catchable fatal error: Argument 2 passed to 
Zend_XmlRpc_Client::__construct() must be an 
instance of Zend_Http_Client

找到了解决方案,这里是:

Found the solution and here it is:

$server = new Zend_XmlRpc_Client('http://127.0.0.1/xmlrpc');

// Get the HTTP Client used by the XMLRPC client
$http_client = $server->getHttpClient();

// Increasing the HTTP timeout
$http_client->setConfig(array('timeout'=>30));

$client = $server->getProxy(); 

单行也对我有用:

$server = new Zend_XmlRpc_Client('http://127.0.0.1/xmlrpc');

// Get the HTTP Client used by the XMLRPC client and increasing the HTTP timeout
$server->getHttpClient()->setConfig(array('timeout'=>30));

$client = $server->getProxy();


推荐答案

Zend文档指定允许使用的配置参数。我想您可以将超时时间从10秒增加到20或30。无论什么适合您。

Zend documentation specifies the configuration parameters that you are allowed to use. I would guess that you can simply increase the timeout from 10 seconds to 20 or 30. Whatever is appropriate for you.

$client = new Zend_Http_Client('http://example.org', array('timeout' => 30));

或:

$client->setConfig(array('timeout'=>30));

更新-Zend_XmlRpc_Client使用Zend_Http_Client。您可以通过Zend_XmlRpc_Client对象设置和访问Zend_Http_Client。

UPDATE - Zend_Http_Client is used by Zend_XmlRpc_Client. You can set and access the Zend_Http_Client via the Zend_XmlRpc_Client object.

$xmlrpc_client = new Zend_XmlRpc_Client('http://127.0.0.1/xmlrpc');
$xmlrpc_client->getHttpClient()->setConfig(array('timeout'=>30'));

我还没有测试过,所以我不知道它会起作用,但是您也可以通过使用setHttpClient()方法将您自己的Zend_Http_Client对象转换为Zend_XmlRpc_Client对象,如Zend 文档页面

I haven't tested this so I don't know that it will work but you can also pass in your own Zend_Http_Client object to a Zend_XmlRpc_Client object using the setHttpClient() method as described (rather arcanely) at the bottom of the Zend documentation page for Zend_XmlRpc_Client.

这篇关于XMLRPC Zend_Http_Client_Adapter_Exception',消息“读取在10秒后超时”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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