PHP5 Soap Extension Connection Timeouts

From: Date: Fri, 19 Aug 2005 00:15:26 +0000
Subject: PHP5 Soap Extension Connection Timeouts
Groups: php.soap 
Request: Send a blank email to php-soap+get-1967@lists.php.net to get a copy of this message
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); }

« previous php.soap (#1967) next »