php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50917 Array elements not named properly when serialized to SOAP XML
Submitted: 2010-02-02 20:25 UTC Modified: -
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: ianare at gmail dot com Assigned:
Status: Open Package: SOAP related
PHP Version: 5.2.13RC1 OS: Linux 2.6.31
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
33 + 16 = ?
Subscribe to this entry?

 
 [2010-02-02 20:25 UTC] ianare at gmail dot com
Description:
------------
System info :
Ubuntu 9.10 (Karmic)
kernel 2.6.31
./configure --enable-soap
PHP 5.2.13RC1-dev (cli) (built: Feb  2 2010 12:40:11) (DEBUG)

Problem :
When an array is serialzed into XML to be sent as a SOAP request, the naming of the array's elements do not match what is defined in the WSDL file. Instead the elements are named 'item'.
This only happens to multidimensional arrays or an 'array within an object within an array'. The top-level array's elements do get named properly.

Thank you.

Reproduce code:
---------------
There are two files. One is the test script, the other is the WSDL file. Both can be downloaded from here:
http://file-folder-ren.sourceforge.net/dev_src/

Expected result:
----------------
This is the XML structure expected by the WSDL file. Note that the  elements within 'criteria' are named 'criterion'.

<criterion xsi:type="groupCriterion">
<criteria>
  <criterion xsi:type="simpleCriterion">
    <key>id</key>
    <specimen xsi:type="stringSpecimen">
      <value>someValue</value>
    </specimen>
  </criterion>
  <criterion xsi:type="simpleCriterion">
    <key>id</key>
    <specimen xsi:type="stringSpecimen">
      <value>someValue</value>
    </specimen>
  </criterion>
</criteria>
<negated>false</negated>
<required>true</required>
</criterion>

Actual result:
--------------
This is the XML actually generated by the script. Note that the  elements within 'criteria' are named 'item'. This gets rejected by the real webservice the WSDL file used in this example was taken from.

<criterion xsi:type="groupCriterion">
<criteria>
  <item xsi:type="simpleCriterion">
    <key>id</key>
    <specimen xsi:type="stringSpecimen">
      <value>someValue</value>
    </specimen>
  </item>
  <item xsi:type="simpleCriterion">
    <key>id</key>
    <specimen xsi:type="stringSpecimen">
      <value>someValue</value>
    </specimen>
  </item>
</criteria>
<negated>false</negated>
<required>true</required>
</criterion>

Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 03:01:32 2024 UTC