Bug #66768 [NEW]: SoapClient::__getLastRequest invalid output if SoapClient::__doRequest used
| From: | krzysztof dot lesiczka at gmail dot com | Date: | Tue, 25 Feb 2014 12:10:08 +0000 |
| Subject: | Bug #66768 [NEW]: SoapClient::__getLastRequest invalid output if SoapClient::__doRequest used | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-184410@lists.php.net to get a copy of this message | ||
From: krzysztof dot lesiczka at gmail dot com
Operating system: Ubuntu
PHP version: 5.5.9
Package: SOAP related
Bug Type: Bug
Bug description:SoapClient::__getLastRequest invalid output if SoapClient::__doRequest used
Description:
------------
Method SoapClient::__getLastRequest shows message before use
SoapClient::__doRequest , not truly sended message.
-
I was trying use SoapClient::__doRequest to change output xml
like here http://www.php.net/manual/en/soapclient.dorequest.php#74123
When i was trying check my request using:
echo $client->__getLastRequest();
it shows:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://testnamespace.com/test/"><SOAP-ENV:Body><ns1:HelloWorld/></SOAP-ENV:Body></SOAP-ENV:Envelope>
But when i try to check network comunication
sudo tcpdump -A -i lo dst 127.0.0.1 and port 80
it shows:
...
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
><SOAP-ENV:Body><HelloWorld
xmlns="http://testnamespace.com/test/"/></SOAP-ENV:Body></SOAP-ENV:Envelope>
...
Method SoapClient::__doRequest works fine
but method SoapClient::__getLastRequest shows message before use
SoapClient::__doRequest , not truly sended message.
Test script:
---------------
// client.php
<?php
class TestClient extends \SoapClient
{
public function __doRequest($request, $location, $action, $version,
$one_way = 0)
{
/*
* http://www.php.net/manual/en/soapclient.dorequest.php#74123
*/
$namespace = 'http://testnamespace.com/test/';
$request = preg_replace('/<ns1:(\w+)/', '<$1 xmlns="' .
$namespace . '"', $request, 1);
$request = preg_replace('/<ns1:(\w+)/', '<$1', $request);
$request = str_replace(array('/ns1:', 'xmlns:ns1="' . $namespace
. '"'), array('/', ''), $request);
return parent::__doRequest($request, $location, $action,
$version, $one_way);
}
}
class HelloWorld {}
$options = array();
$client = new TestClient('soap-bug.wsdl', array('trace' => true));
$client->__soapCall('HelloWorld', array(new HelloWorld()));
echo $client->__getLastRequest();
// server.php
// http://www.php.net/manual/en/soapserver.construct.php#108987
Expected result:
----------------
echo $client->__getLastRequest();
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
><SOAP-ENV:Body><HelloWorld
xmlns="http://testnamespace.com/test/"/></SOAP-ENV:Body></SOAP-ENV:Envelope>
Actual result:
--------------
echo $client->__getLastRequest();
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://testnamespace.com/test/"><SOAP-ENV:Body><ns1:HelloWorld/></SOAP-ENV:Body></SOAP-ENV:Envelope>
--
Edit bug report at https://bugs.php.net/bug.php?id=66768&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66768&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66768&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66768&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=66768&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=66768&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=66768&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=66768&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=66768&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=66768&r=support
Expected behavior: https://bugs.php.net/fix.php?id=66768&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=66768&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=66768&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=66768&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66768&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=66768&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=66768&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=66768&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66768&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=66768&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=66768&r=mysqlcfg