php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #38331 Call timeout when the response is chunked
Submitted: 2006-08-04 14:08 UTC Modified: 2017-10-24 07:52 UTC
Votes:11
Avg. Score:4.4 ± 0.8
Reproduced:11 of 11 (100.0%)
Same Version:2 (18.2%)
Same OS:3 (27.3%)
From: ulhin at tdc dot dk Assigned:
Status: Open Package: SOAP related
PHP Version: 5.1.4 OS: Red Hat Enterprise Linux 4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ulhin at tdc dot dk
New email:
PHP Version: OS:

 

 [2006-08-04 14:08 UTC] ulhin at tdc dot dk
Description:
------------
There seems to no way to abort a soap call when the response is chunked and none of the chunks exceed the timeout specified with ini_set('default_socket_timeout', 3).

Reproduce code:
---------------
###### File: client.php
ini_set('default_socket_timeout', 3);
$client = new SoapClient(NULL,
    array(
	    "location" => "http://foobar.dk/soap/server.php", "uri" => "urn:xmethods-delayed-quotes", "style" => SOAP_RPC, "use" => SOAP_ENCODED, "trace" => 1, "connection_timeout" => 3
    )
);
$response = ' [NO RESPONSE] ';
try {
	$response = $client->__call(
	    "getQuote",
	    array(new SoapParam("ibm", "symbol")),
	    array("uri" => "urn:xmethods-delayed-quotes", "soapaction" => "urn:xmethods-delayed-quotes#getQuote")
	);
} catch(Exception $e) {	print "Exception: " . $e->getMessage(); }
print $response;

###### File: server.php
<?php
	print '<?xml version="1.0" encoding="UTF-8"?>';
	for ($i=0; $i<20; $i++) {
		print "<!-- $i -->";
		flush(); // The client will wait 20 seconds for the response. Without flush the client will drop the request after 3 seconds.
		sleep(1);
	}
?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:xmethods-delayed-quotes" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        <SOAP-ENV:Body>
                <ns1:getQuoteResponse>
                        <Result xsi:type="xsd:float">198.4234</Result>
                </ns1:getQuoteResponse>
        </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


Expected result:
----------------
The call duration should be about 3 seconds.

Actual result:
--------------
The actual call duration is 20 seconds.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-04 14:10 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip


 [2006-08-04 19:07 UTC] schack at tdconline dot dk
No change with http://snaps.php.net/php5.2-latest.tar.gz
(php5.2-200608041430)

Timeout is still not working.
 [2006-08-07 11:44 UTC] dmitry@php.net
This is not a bug.
"default_socket_timeout" sets timeout for single read() call. ext/soap breaks reading if nothing was received from server in "default_socket_timeout", but it doesn't assume that whole resonse must be read before it exceeded.
 [2006-08-08 19:13 UTC] dmitry@php.net
This is not a bug but feature request.
SoapClient needs additional option "request_timeout" (in additional to "connection_timeout").
 [2010-12-20 14:16 UTC] jani@php.net
-Summary: SOAP call timeout when the response is chunked +Summary: Call timeout when the response is chunked -Package: Feature/Change Request +Package: SOAP related
 [2017-10-24 07:52 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: dmitry +Assigned To:
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 13:01:28 2024 UTC