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
 [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

Pull Requests

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 12 16:01:27 2024 UTC