xsd:choice maxOccurs=unbounded, and element order

[email protected] (Simon Detheridge)
Newsgroups php.soap
Message-ID <[email protected]>
Hi,

Sorry for crossposting. I sent this to php-general yesterday, not  
realising there was a specific SOAP list...

I'm trying to make PHP5's soap implementation play nice with my web  
service, and I'm
having a problem.

Part of my schema contains a complexType, containing an xsd:choice of  
several different
element types, which can be repeated many times (maxOccurs=unbounded)

e.g.:

<xsd:complexType name='containertype'>
   <xsd:sequence>
     <xsd:choice maxOccurs='unbounded'>
       <xsd:element name='e1' type='e1type'>
       <xsd:element name='e2' type='e2type'>
     </xsd:choice>
   </xsd:sequence>
</xsd:complexType>

The problem is that the order of element here is important. I want the  
results returned
in the same order that they appear in the XML.

Unfortunately, what I end up with, is an object containing an array of  
all the e1
elements, followed by an array of all the e2 elements.

Take the following example... If there following were in my soap result:

<container>
   <e1>some_stuff</e1>
   <e2>different_stuff</e2>
   <e1>some_other_stuff</e1>
   <e2>different_other_stuff</e2>
</container>

What I actually end up seeing is something like:

[container] => stdClass Object
   (
     [e1] Array
       (
         [0] => some_stuff
         [1] => some_other_stuff
       )
     [e2] Array
       (
         [0] => different_stuff
         [1] => different_other_stuff
       )
   }

Note that this is somewhat simplified from my real-world example. In  
reality, "e1" and
"e2" are complexTypes themselves.

But I really do need to see the resulting elements in the same order  
that they were
supplied. I'm able to do this in dotnet and gsoap clients, so far. (I  
haven't tried any
others.)

Incidentally, I'm using a basic unmodified skeleton generated by  
wsdl2php as my classmap.
The object describing the 'container' type looks simply like:

class container {
}

Perhaps it's possible to add something to this to help sort the order out??

Any suggestions are appreciated. Could this be a bug?

Incidentally, the full-blown (and rather complicated I'm afraid)  
schema/wsdl for what I'm
*actually* trying to do is at http://www.widgit.com/cml/symgate.wsdl  
if that helps.

Thanks,
Simon

-- 
Simon Detheridge
SEN Developer, Widgit Software






CONFIDENTIALITY NOTICE:
This email and any attachments are for the exclusive and confidential use of the intended recipient.  If you are not the intended recipient, please do not read, distribute or take action in reliance upon this message. If you have received this in error, please notify us immediately by return email and promptly delete this message and its attachments from your computer system.

Logotron is a limited company registered in England, number 04113866. The registered office is Logotron Ltd, 124 Cambridge Science Park, Milton Road, Cambridge, CB4 0ZS.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.