PHP5 Soap Extension Connection Timeouts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Had to dig to find the undocumented connection_timeout parameter you can use in the soapclient and thought I'd share it here for anyone doing a search in the future:

setting a connection timeout

$client = new SoapClient($wsdl, array("connection_timeout"=>5));

ideally you'd have two timeouts set in your application one for how long it should take to actually connect to your remote host and a timeout for how long the socket connection should wait for a response from the server

the above addresses the time it takes to wait to connect to your host and this addresses the time to wait for a response

ini_set('default_socket_timeout', 180);

I would wrap this in a configuration option in case you distribute your package and different clients might need different timeouts when dealing with slow soap server responses.

// SET SOCKET TIMEOUT
if(defined('RESPONSE_TIMEOUT') &&  RESPONSE_TIMEOUT != '') {
	ini_set('default_socket_timeout', RESPONSE_TIMEOUT);
}

--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux