php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38163 Problem in communication to http server using soap client of php
Submitted: 2006-07-20 14:43 UTC Modified: 2006-08-22 08:09 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:2 (66.7%)
From: imthiazj2 at hcl dot in Assigned: dmitry (profile)
Status: Not a bug Package: SOAP related
PHP Version: 5.1.4 OS: Solaris
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: imthiazj2 at hcl dot in
New email:
PHP Version: OS:

 

 [2006-07-20 14:43 UTC] imthiazj2 at hcl dot in
Description:
------------
Hi, 

I am connecting a http server, using soap client.Since the http server is not responding, the soap client remains connecting to it.So the apache port becomes in time_wait and it stops listening from further request. It leads to a situation where the apache has to be restarted.
It is similar to 33765, but here the server is not responding, so the apache hangs



Reproduce code:
---------------
$client = new SoapClient(NULL,
        array(
        "location" => $location,
        "login" => "root",
        "uri" => "urn:gsnmp",
        "password" => "12345678",
        "exceptions" => 1,
        "trace"    => 1,
        "features"=>SOAP_WAIT_ONE_WAY_CALLS
           ));
ini_set('default_socket_timeout', 10)
$result = $client->__doRequest("",$locationwithdata,"",1);


Expected result:
----------------
The soap client should wait for few seconds and returns error or soap fault.
So that it should avoid from apache hanging.


Actual result:
--------------
It makes apache server to hang and needs to restart for processing further request

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-20 14:54 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-07-24 09:48 UTC] imthiazj2 at hcl dot in
Hi,

I used the php version of 5.2. But still the problem is existing and the whole apache is getting hang and not processing further request. It needs restart of the apache.

Can you please help me overcome this problem.

Thanks
J.Imthiaz
 [2006-07-25 09:23 UTC] dmitry@php.net
SoapClient::__doRequest() shouldn't return fault it should return SOAP response (XML representation).
Use SoapClient::__soapCall() instead and you will get fault.

BTW PHP shouldn't hang.
How does SOAP server respond?
(HTTP headers, timeouts, response body)
 [2006-07-25 14:57 UTC] imthiazj2 at hcl dot in
I don't connect to soap server, I connect it to http server.
Nothing is sent back to the php.
 [2006-07-26 10:12 UTC] dmitry@php.net
I cannot reproduce hangup.

1. May be your web server runs just one process and cannot accept connection. Try to add "connection_timeout" into SoapClient constructor.

$client = new SoapClient(NULL,
        array("connection_timeout => 10, ...

2. In case if you are calling one-way operation without response, you should add additional argument (one_way operation) to __doRequest() call.

result = $client->__doRequest("",$locationwithdata,"",1,1);




 [2006-07-27 10:06 UTC] imthiazj2 at hcl dot in
Still it gets hangup.
Is it possible to mention non-blocking mode of connection in soap request
 [2006-07-27 11:01 UTC] dmitry@php.net
Please run the following script from command line and provide output.

<?php
$server = stream_socket_server('tcp://127.0.0.1:31337');
$location = "http://127.0.0.1:31337/";
$client = new SoapClient(NULL, array(
  "connection_timeout" => 4,
  "location" => $location,
  "uri" => "test://",
  "features"=>SOAP_WAIT_ONE_WAY_CALLS));
ini_set('default_socket_timeout', 2);
$result = $client->__doRequest("",$location,"",1,1);
var_dump($result);
$result = $client->__doRequest("",$location,"",1);
var_dump($result);
$client->test();
fclose($server);
?>
 [2006-07-27 12:01 UTC] imthiazj2 at hcl dot in
Warning: SoapClient::__doRequest() expects exactly 4 parameters, 5 given in /home/amudha/B16/galad/apache/htdocs/faultperf/l/php/a.php on line 11

Fatal error: SoapClient::__doRequest(): Invalid parameters in /home/amudha/B16/galad/apache/htdocs/faultperf/l/php/a.php on line 11

After correcting the error:


NULL
NULL

Fatal error: Uncaught SoapFault exception: [HTTP] Error Fetching http headers in /home/amudha/B16/galad/apache/htdocs/faultperf/l/php/a.php:15
Stack trace:
#0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'http://127.0.0....', 'test://#test', 1)
#1 [internal function]: SoapClient->__call('test', Array)
#2 /home/amudha/B16/galad/apache/htdocs/faultperf/l/php/a.php(15): SoapClient->test()
#3 {main}
  thrown in /home/amudha/B16/galad/apache/htdocs/faultperf/l/php/a.php on line 15
 [2006-08-22 08:09 UTC] dmitry@php.net
Which version of PHP do you use?
The one-way operations are supported since php-5.1.4 and you reported that bug is in php-5.1.4, but SoapClient::__doRequest() accept 5 arguments in php-5.1.4.
So you probably use some old version that doesn't support one-way operations.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 11:01:29 2024 UTC