php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32117 ComplexType Encoding Incorrect
Submitted: 2005-02-26 00:42 UTC Modified: 2005-03-05 13:26 UTC
From: rtroll at yahoo-inc dot com Assigned: dmitry (profile)
Status: Not a bug Package: SOAP related
PHP Version: 5CVS-2005-02-26 OS: *
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: rtroll at yahoo-inc dot com
New email:
PHP Version: OS:

 

 [2005-02-26 00:42 UTC] rtroll at yahoo-inc dot com
Description:
------------
When encoding a complex array datatype (via a doc/literal request); the encoding is incorrect.  The following code performs a request, and displays the request/response structures.  The server is unable to locate the client supplied params, due to the request being (I believe) incorrect.

Additionally, PHP appears to not be sending over array element 0 in this demo.

Reproduce code:
---------------
<?php
$WSDL = "http://ws1.api.re2.yahoo.com/ws/soap-demo/full.wsdl";
$DEBUG=true;

$client = new SoapClient( $WSDL, array( "trace" => $DEBUG,
                                        "exceptions" => 0,
                                        ));

function dump_xml( $title, $body )
{
    $nl = preg_replace( "/\>\</", ">\n<", $body );
    $clean = htmlspecialchars( $nl );
    print "\n<b>$title</b>\n<pre>$clean</pre>\n";
}

$r = $client->strArrayReverse('This', 'is', 'a', 'test', '.');
dump_xml( "Request", $client->__getLastRequest() );
dump_xml( "Response", $client->__getLastResponse() );
?>


Expected result:
----------------
The request should be:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:yahoo:platform:soap:demo:full">
<SOAP-ENV:Body>
 <ns1:strArrayReverse>
 <ns1:saVal>
 <param0>This</param0>
<param1>is</param1>
<param2>a</param2>
<param3>test</param3>
<param4>.</param4>
 </ns1:saVal>
 </ns1:strArrayReverse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Note that the method being accessed (strArrayReverse) now contains a single arg (saVal), which is an array of 5 elements.  Also note that param0 is present.

This request will elicit the correct response from the server.

Indent lines indicate lines that have been added, or changed, compared to the original request sent from PHP.

Actual result:
--------------
The request being generated by PHP's soap interface is:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:yahoo:platform:soap:demo:full">
<SOAP-ENV:Body>
<ns1:strArrayReverse/>
<param1>is</param1>
<param2>a</param2>
<param3>test</param3>
<param4>.</param4>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-05 13:26 UTC] dmitry@php.net
You should use the folowing call:

$r = $client->strArrayReverse(array('saVal'=>array('This', 'is', 'a', 'test', '.')));

Look into the WSDL.

The "strArrayReverse" method has one parameter of type "full:strArrayReverse", that is a sequence of ONE element named "saVal" of type "stringArray".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 21:01:28 2024 UTC