Bug #73089 [ReO]: SOAP pass dictionary parameter

From: Date: Fri, 02 Dec 2016 12:49:30 +0000
Subject: Bug #73089 [ReO]: SOAP pass dictionary parameter
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205737@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73089&edit=1 ID: 73089 User updated by: matteo dot veggia at gmail dot com Reported by: matteo dot veggia at gmail dot com Summary: SOAP pass dictionary parameter Status: Re-Opened Type: Bug Package: SOAP related Operating System: Windows -PHP Version: 7.0.13 +PHP Version: 7.1.0 Block user comment: N Private report: N New Comment: The problem persist.... Please help. Previous Comments: ------------------------------------------------------------------------ [2016-11-14 10:45:30] matteo dot veggia at gmail dot com The issue persists with PHP Version 7.0.13! I rewrite my code to remake the question simplified: $url = "wwwp.example.com/hello.svc?wdsl"; $options = Array("trace"=>1); //FIRST METHOD!!! (not working) $soapClient = new SoapClient($url, $options); $argsSOAP = new StdClass(); $argsSOAP->Data = Array(); array_push($argsSOAP->Data, Array("Key"=>"A", "Value"=>"1")); array_push($argsSOAP->Data, Array("Key"=>"B", "Value"=>"2")); $resSOAP = $soapClient->TestRoutineDictionary($argsSOAP); echo "REQUEST:<br>" . htmlspecialchars(str_ireplace('><', ">\n<", $soapClient->__getLastRequest())) . "<br>"; echo "Response:<br>" . htmlspecialchars(str_ireplace('><', ">\n<", $soapClient->__getLastResponse())) . "<br>"; echo "\n\n<hr>\n\n"; //SECOND METHOD (working...) $soapClient2 = new SoapClient($url, $options); $argsSOAP2 = new StdClass(); $argsSOAP2->Data = Array(); $argsSOAP2->Data[0] = Array("Key"=>"A", "Value"=>"1"); $argsSOAP2->Data[1] = Array("Key"=>"B", "Value"=>"2"); $resSOAP2 = $soapClient2->TestRoutineDictionary($argsSOAP2); echo "REQUEST:<br>" . htmlspecialchars(str_ireplace('><', ">\n<", $soapClient2->__getLastRequest())) . "<br>"; echo "Response:<br>" . htmlspecialchars(str_ireplace('><', ">\n<", $soapClient2->__getLastResponse())) . "<br>"; I execute this script with php.exe (without apache!) The results are different! In the first result is missing "http://schemas.microsoft.com/2003/10/Serialization/Arrays"... Please help me. Matteo ------------------------------------------------------------------------ [2016-10-24 14:58:56] matteo dot veggia at gmail dot com I test with apache and php: with your test (with some updates): <?php $client = new class(null, ['location' => '', 'uri' => 'http://example.org', 'trace' => 1]) extends SoapClient { public function __doRequest($request, $location, $action, $version, $one_way = 0) { //echo $request; return ''; } }; $argsSOAP = new StdClass(); $argsSOAP->Data = Array(); array_push($argsSOAP->Data, Array("Key"=>"A", "Value"=>"1")); array_push($argsSOAP->Data, Array("Key"=>"B", "Value"=>"2")); $res = $client->TestRoutineDictionary($argsSOAP); echo "REQUEST:<br>" . htmlspecialchars(str_ireplace('><', ">\n<", $client->__getLastRequest())) . "<br>"; ?> WORKS!!!!! BUT with "my" client: <?php $url = "http://mylink.org/myservice.svc?wsdl"; $client = new SoapClient($url, array('trace' => 1)); $argsSOAP = new StdClass(); $argsSOAP->Data = Array(); array_push($argsSOAP->Data, Array("Key"=>"A", "Value"=>"1")); array_push($argsSOAP->Data, Array("Key"=>"B", "Value"=>"2")); $res = $client->TestRoutineDictionary($argsSOAP); echo "REQUEST:<br>" . htmlspecialchars(str_ireplace('><', ">\n<", $client->__getLastRequest())) . "<br>"; //echo "Response:<br>" . htmlspecialchars(str_ireplace('><', ">\n<", $client->__getLastResponse())) . "<br>"; ?> appears the problem: <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/"> <SOAP-ENV:Body> <ns1:TestRoutineDictionary> <ns1:Data/> </ns1:TestRoutineDictionary> </SOAP-ENV:Body> </SOAP-ENV:Envelope> I await your response ------------------------------------------------------------------------ [2016-10-24 14:45:23] matteo dot veggia at gmail dot com Your test works! is Apache environment? I'm using Apache/2.4.23. What's your suggestions? ------------------------------------------------------------------------ [2016-10-24 14:20:55] nikic@php.net I just downloaded the PHP 7.0.12 NTS VC14 x64 build from http://windows.php.net/download/ and ran ./php.exe -dextension=pwd/ext/php_soap.dll test.php Where test.php contains: <?php $client = new class(null, ['location' => '', 'uri' => 'http://example.org']) extends SoapClient { public function __doRequest($request, $location, $action, $version, $one_way = 0) { echo $request; return ''; } }; $argsSOAP = new StdClass(); $argsSOAP->Data = Array(); array_push($argsSOAP->Data, Array("Key"=>"A", "Value"=>"1")); array_push($argsSOAP->Data, Array("Key"=>"B", "Value"=>"2")); $client->TestRoutine($argsSOAP); And received the output: <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://example.org" xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:TestRoutine><param0 xsi:type="SOAP-ENC:Struct"><Data SOAP-ENC:arrayType="ns2:Map[2]" xsi:type="SOAP-ENC:Array"><item xsi:type="ns2:Map"><item><key xsi:type="xsd:string">Key</key><value xsi:type="xsd:string">A</value></item><item><key xsi:type="xsd:string">Value</key><value xsi:type="xsd:string">1</value></item></item><item xsi:type="ns2:Map"><item><key xsi:type="xsd:string">Key</key><value xsi:type="xsd:string">B</value></item><item><key xsi:type="xsd:string">Value</key><value xsi:type="xsd:string">2</value></item></item></Data></param0></ns1:TestRoutine></SOAP-ENV:Body></SOAP-ENV:Enve! lope> Which is the expected output. Which PHP build are you using? Is it a standard windows.php.net build or from some other packager? To preclude configuration problems, can you check what result you get when running directly from CLI (w/o server)? ------------------------------------------------------------------------ [2016-10-24 12:40:42] matteo dot veggia at gmail dot com Any news? I need this fix... ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=73089 -- Edit this bug report at https://bugs.php.net/bug.php?id=73089&edit=1

« previous php.bugs (#205737) next »