From:             alexander at abee dot de
Operating system: Windows XP SP2
PHP version:      5.2.3
PHP Bug Type:     SOAP related
Bug description:  SOAP call returns null when script is executed twice 
simultaneously

Description:
------------
I wrote a very simple webservice using Axis2 in Java and deployed it using
Apache Tomcat. The soap service contains just two functions, dummy and
dummy2. Both functions just sleep for a second and then return an integer
(42 and 43).

When I execute the php client code below once, the output is as expected
($v1 is 42 and $v2 is 43) but when I hit reload before both calls are
finished I only get a return value from the second call although
"__getLastResponse()" returns a valid xml document which contains the
expected result.

It looks like the parsing of the xml response doesn't work correctly when
multiple threads are running.

Strangely this doesn't happen when I call the same method twice (ie. dummy
and then dummy again in the same script) - then I get the same value in $v1
and $v2.

As __getLastResponse() return the correct xml response I assume this is a
php bug and not an Axis2 bug.

I tried several versions of PHP including 5.1.2.2, 5.2.3 and the latest
snapshot - all with the same result.

Reproduce code:
---------------
<?php
function printResult($result, $soap)
{
    print "<pre>\n";
    print "Result :\n"; var_dump($result); print "\n";
    print "Request :\n".htmlspecialchars($soap->__getLastRequest())
."\n";
    print
"Response:\n".htmlspecialchars($soap->__getLastResponse())."\n";
    print "</pre><br>"; 
}

$soap = new
SoapClient('http://127.0.0.1:8080/axis2/services/WebhandlerService?wsdl', 
    array('trace' => 1));

$v1 = $soap->dummy(array('v' => '4'));
printResult($v1, $soap);

$v2 = $soap->dummy2(array('v' => '5'));
printResult($v2, $soap);
?>


Expected result:
----------------
This is the result I expect and which I get on the first call of the php
script:

<pre>
Result :
object(stdClass)#2 (1) {
  ["return"]=>
  int(42)
}

Request :
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;SOAP-ENV:Envelope
xmlns:SOAP-ENV=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;
xmlns:ns1=&quot;http://webhandler.zmi.de/xsd&quot;&gt;&lt;SOAP-ENV:Body&gt;&lt;ns1:dummy&gt;&lt;ns1:v&gt;4&lt;/ns1:v&gt;&lt;/ns1:dummy&gt;&lt;/SOAP-ENV:Body&gt;&lt;/SOAP-ENV:Envelope&gt;

Response:
&lt;?xml version='1.0' encoding='utf-8'?&gt;&lt;soapenv:Envelope
xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;&lt;soapenv:Body&gt;&lt;ns:dummyResponse
xmlns:ns=&quot;http://webhandler.zmi.de/xsd&quot;&gt;&lt;ns:return&gt;42&lt;/ns:return&gt;&lt;/ns:dummyResponse&gt;&lt;/soapenv:Body&gt;&lt;/soapenv:Envelope&gt;
</pre><br><pre>
Result :
object(stdClass)#3 (1) {
  ["return"]=>
  int(43)
}

Request :

&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;SOAP-ENV:Envelope
xmlns:SOAP-ENV=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;
xmlns:ns1=&quot;http://webhandler.zmi.de/xsd&quot;&gt;&lt;SOAP-ENV:Body&gt;&lt;ns1:dummy2&gt;&lt;ns1:v&gt;5&lt;/ns1:v&gt;&lt;/ns1:dummy2&gt;&lt;/SOAP-ENV:Body&gt;&lt;/SOAP-ENV:Envelope&gt;

Response:
&lt;?xml version='1.0' encoding='utf-8'?&gt;&lt;soapenv:Envelope
xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;&lt;soapenv:Body&gt;&lt;ns:dummy2Response
xmlns:ns=&quot;http://webhandler.zmi.de/xsd&quot;&gt;&lt;ns:return&gt;43&lt;/ns:return&gt;&lt;/ns:dummy2Response&gt;&lt;/soapenv:Body&gt;&lt;/soapenv:Envelope&gt;
</pre><br>

Actual result:
--------------
This is the result I get when I hit the reload button twice:

<pre>
Result :
NULL

Request :
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;SOAP-ENV:Envelope
xmlns:SOAP-ENV=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;
xmlns:ns1=&quot;http://webhandler.zmi.de/xsd&quot;&gt;&lt;SOAP-ENV:Body&gt;&lt;ns1:dummy&gt;&lt;ns1:v&gt;4&lt;/ns1:v&gt;&lt;/ns1:dummy&gt;&lt;/SOAP-ENV:Body&gt;&lt;/SOAP-ENV:Envelope&gt;

Response:
&lt;?xml version='1.0' encoding='utf-8'?&gt;&lt;soapenv:Envelope
xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;&lt;soapenv:Body&gt;&lt;ns:dummy2Response
xmlns:ns=&quot;http://webhandler.zmi.de/xsd&quot;&gt;&lt;ns:return&gt;42&lt;/ns:return&gt;&lt;/ns:dummy2Response&gt;&lt;/soapenv:Body&gt;&lt;/soapenv:Envelope&gt;
</pre><br><pre>
Result :
object(stdClass)#2 (1) {
  ["return"]=>
  int(43)
}

Request :

&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;SOAP-ENV:Envelope
xmlns:SOAP-ENV=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;
xmlns:ns1=&quot;http://webhandler.zmi.de/xsd&quot;&gt;&lt;SOAP-ENV:Body&gt;&lt;ns1:dummy2&gt;&lt;ns1:v&gt;5&lt;/ns1:v&gt;&lt;/ns1:dummy2&gt;&lt;/SOAP-ENV:Body&gt;&lt;/SOAP-ENV:Envelope&gt;

Response:
&lt;?xml version='1.0' encoding='utf-8'?&gt;&lt;soapenv:Envelope
xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;&lt;soapenv:Body&gt;&lt;ns:dummy2Response
xmlns:ns=&quot;http://webhandler.zmi.de/xsd&quot;&gt;&lt;ns:return&gt;43&lt;/ns:return&gt;&lt;/ns:dummy2Response&gt;&lt;/soapenv:Body&gt;&lt;/soapenv:Envelope&gt;
</pre><br>

-- 
Edit bug report at http://bugs.php.net/?id=42010&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=42010&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=42010&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=42010&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=42010&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=42010&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=42010&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=42010&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=42010&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=42010&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=42010&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=42010&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=42010&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=42010&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42010&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=42010&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=42010&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=42010&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42010&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=42010&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=42010&r=mysqlcfg

Reply via email to