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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ianare at gmail dot com
New email:
PHP Version: OS:

 

 [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-2019 The PHP Group
All rights reserved.
Last updated: Thu Sep 19 03:01:28 2019 UTC