Bug #48584 [Com]: soapclient's option connection_timeout not respected while fetching wsdl

From: Date: Thu, 29 Sep 2011 18:31:15 +0000
Subject: Bug #48584 [Com]: soapclient's option connection_timeout not respected while fetching wsdl
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-163981@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=48584&edit=1

 ID:                 48584
 Comment by:         tanealbhandari at gmail dot com
 Reported by:        giunta dot gaetano at gmail dot com
 Summary:            soapclient's option connection_timeout not respected
                     while fetching wsdl
 Status:             Open
 Type:               Bug
 Package:            SOAP related
 Operating System:   winxp
 PHP Version:        5.2.9
 Block user comment: N
 Private report:     N

 New Comment:

Will setting a value for 'default_socket_timeout' work for SSL connections?


Previous Comments:
------------------------------------------------------------------------
[2009-06-24 07:55:01] giunta dot gaetano at gmail dot com

Thanks for your comment, that's exactly what I did for my needs.
Still I find it quite cumbersome (and counterintuitive).
Here's a better syntax btw, especially when creating a library and not just a one-page app
<?php
...
// Wait one second for connection when retrieving WSDL:
$deftimeout = ini_get( 'default_socket_timeout' );
ini_set('default_socket_timeout', 1);
try {
  $c = new SoapClient('http://123.123.123.123/bla.wsdl');
  ini_set( 'default_socket_timeout', $deftimeout );
  ...
} catch (exception $e) {
  ini_set( 'default_socket_timeout', $deftimeout );
  ...
}

?>

------------------------------------------------------------------------
[2009-06-23 19:20:45] sjoerd-php at linuxonly dot nl

Thank you for your bug report.

The connection_timeout option defines a timeout in seconds for the connection to the SOAP service.
This option does not define a timeout for services with slow responses. To limit the time to wait
for calls to finish the default_socket_timeout setting is available.

<?php
// Wait one second for connection when retrieving WSDL:
ini_set('default_socket_timeout', 1);
new SoapClient('http://123.123.123.123/bla.wsdl');
?>

------------------------------------------------------------------------
[2009-06-17 14:18:14] giunta dot gaetano at gmail dot com

Description:
------------
The socket timeout option for soap clients is only respected when executing calls, but not when
fetching the wsdl itself.
This makes it quite hard to use remote wsdl files and provide to the end user an interface with a
definite timeout (eg. 5 secs).
Current code does not seem to use the timeout value in c function get_sdl in php_sdl.c

Reproduce code:
---------------
create a soap client pointing to a wsdl on an inexisting server
set connection_timeout option to 5 in client constructor


Expected result:
----------------
error msg after 5 secs

Actual result:
--------------
error msg after 1 min


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=48584&edit=1


Thread (5 messages)

« previous php.bugs (#163981) next »