php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45284 SOAP does not handle unbounded sequence of elements
Submitted: 2008-06-16 18:32 UTC Modified: 2008-06-18 09:32 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: pgiralt at cisco dot com Assigned: dmitry (profile)
Status: Not a bug Package: SOAP related
PHP Version: 5.2.6 OS: Ubuntu Linux 8.04
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 !
Your email address:
MUST BE VALID
Solve the problem:
23 - 22 = ?
Subscribe to this entry?

 
 [2008-06-16 18:32 UTC] pgiralt at cisco dot com
Description:
------------
When an XSD file contains a sequence like this: 

	<xsd:complexType name="XMediaResourceGroup">
		<xsd:sequence minOccurs="0">
			<xsd:element name="name" type="axl:String50"/>
			<xsd:element name="description" type="axl:String50" minOccurs="0"/>
			<xsd:element name="multicast" type="xsd:boolean"/>
			<xsd:element name="members">
				<xsd:complexType>
					<xsd:sequence>
						<xsd:element name="member" type="axl:XMediaResourceGroupMember" maxOccurs="unbounded"/>
					</xsd:sequence>
				</xsd:complexType>
			</xsd:element>
		</xsd:sequence>
		<xsd:attribute name="uuid" type="axl:XUUID"/>
	</xsd:complexType>


	<xsd:complexType name="XMediaResourceListMember">
		<xsd:choice>
			<xsd:element name="mediaResourceGroup" type="axl:XMediaResourceGroup">
				<xsd:annotation>
					<xsd:documentation>Only the uuid attribute is read by the AXL API.</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
			<xsd:element name="mediaResourceGroupName" type="axl:String50"/>
		</xsd:choice>
		<xsd:attribute name="uuid" type="axl:XUUID"/>
		<xsd:attribute name="order" type="xsd:nonNegativeInteger"/>
	</xsd:complexType>


When I include the array of members for the sequence in the 
type XMediaResourceGroup, the PHP SOAP does not send the 
sequence. See below for expected and actual results. 

I have confirmed this works in 5.2.1 and is broken in 5.2.3, 5.2.4, 
and 5.2.6. I am unable to test with 5.2.2 or 5.2.5. 

The problem reported in 42723 seems similar, however that submitter
did not appear to describe the problem very well. 




Reproduce code:
---------------
Reproduce code can be downloaded here: 

http://www.employees.org/~pgiralt/phpbug2/phpbug.tar

Once untarred, run axl_test.php to reproduce the problem. 

Included in the tarball is a directory that contains the SOAP
schema (axl60), file that contains a class (axlsoap.php) and the
script with the reproduction code (axl_test.php). 

Expected result:
----------------
POST /axl/ HTTP/1.1
Host: 14.87.10.10:8443
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.2.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "addMediaResourceList"
Content-Length: 595

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.cisco.com/AXL/API/1.0">
  <SOAP-ENV:Body>
    <ns1:addMediaResourceList>
      <mediaResourceList>
        <name>TestMRGL</name>
        <members>
          <member order="1">
            <mediaResourceGroupName>Member1</mediaResourceGroupName>
          </member>
          <member order="2">
            <mediaResourceGroupName>Member2</mediaResourceGroupName>
          </member>
          <member order="3">
            <mediaResourceGroupName>Member3</mediaResourceGroupName>
          </member>
        </members>
      </mediaResourceList>
    </ns1:addMediaResourceList>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Actual result:
--------------
POST /axl/ HTTP/1.1
Host: 14.87.10.10:8443
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.2.6-1ubuntu1
Content-Type: text/xml; charset=utf-8
SOAPAction: "addMediaResourceList"
Content-Length: 355

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.cisco.com/AXL/API/1.0">
  <SOAP-ENV:Body>
    <ns1:addMediaResourceList>
      <mediaResourceList>
        <name>TestMRGL</name>
        <members>
          <member/>
        </members>
      </mediaResourceList>
    </ns1:addMediaResourceList>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-06-18 09:32 UTC] dmitry@php.net
ext/soap converts into sequence od elements only "plain" arrays (they must contain only ordered numeric indexes starting from zero),

Just change your code, to produce array with indexes starting from 0 instead of 1, to make it work.

function AddMrgl($name, $members) {
  $mrglData->name = $name;
  $i = 0;
  foreach($members as $member) {
    $mrglData->members->member[$i]->mediaResourceGroupName = $member;
    $mrglData->members->member[$i]->order = ++$i;
  }
  return $this->AddMrglData($mrglData);
}

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 08:01:27 2024 UTC