note 55957 rejected from function.soap-soapclient-construct by simp
| From: | simp@php.net | Date: | Thu, 24 Aug 2006 07:27:53 +0000 |
| Subject: | note 55957 rejected from function.soap-soapclient-construct by simp | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-116249@lists.php.net to get a copy of this message | ||
Note Submitter: Jim Plush
----
an undocumented feature -> 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);
}