XMLRPC Zend_Http_Client_Adapter_Exception 'with the message' Timeout is checked after 10 seconds

I googled everywhere, but no one posted the solution, everyone says to set a timeout in the config, but how do you do it?

How to reset / override this parameter from my client or XMLRPC server?

Here is what I am trying:

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

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

Here is the error:

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

Try to pass as arg:

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

Here is the error:

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

Found a 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(); 

One line works for me too:

$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();
+3
source share
2 answers

The Zend documentation defines the configuration options that you are allowed to use. I would suggest that you can simply increase the timeout from 10 seconds to 20 or 30. No matter what suits you.

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

or

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

UPDATE - Zend_Http_Client Zend_XmlRpc_Client. Zend_Http_Client Zend_XmlRpc_Client.

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

, , , Zend_Http_Client Zend_XmlRpc_Client, setHttpClient(), ( arcanely) Zend Zend_XmlRpc_Client.

+15

, :

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

$client Rest Soap.

, , :

client->getHttpClient()->setConfig(array('timeout'=>30')); - remove single quote after 30
+1

Source: https://habr.com/ru/post/1782788/


All Articles