|
Posted by Simon Detheridge on 01/09/06 23:34
I have a problem with PHP talking to my non-php webservice.
The problem arises because I have a list of elements in an umbounded
xsd:choice type, which are supposed to be parsed in the correct order.
Unfortunately, PHP groups them together per-type instead of in the
order they appear in the document.
** warning: the example below is not taken from real data... I've
created a simple example based on what my more complex project is
actually doing. It may not be 100% accurate, but serves to show the
problem behaviour.
For example, let's say I have the following element:
<xsd:element name='foo'>
<xsd:complexType>
<xsd:choice minOccurs='1' maxOccurs='unbounded'>
<xsd:element name='bar' type='xsd:string' />
<xsd:element name='baz' type='xsd:string' />
</xsd:choice>
</xsd:complexType>
</xsd:element>
Now, let's assume that this comes as a soap response, encoded
document/literal, with the following data:
<foo>
<bar>One</bar>
<baz>Two</baz>
<bar>Three</bar>
<baz>Four</baz>
</foo>
For an element of this type, when php parses my WSDL, it generates the
following type (according to SoapClient->__getTypes() ):
struct foo {
string bar;
string baz;
}
Now... Upon parsing the result of the transaction, I get the following:
[foo] => stdClass Object
(
[bar] => Array
(
[0] => One
[1] => Three
)
[baz] => Array
(
[0] => Two
[1] => Four
)
)
--- end of example ---
What I want PHP to do, is enable me to access my 'bar' and 'baz'
elements in the order in which they appear in the document, instead of
having it glob them together for each type. However, I am unable to
modify the output of the webservice itself as it interoperates nicely
with other things already.
Can I get There from Here with PHP's own SoapClient, or do I have to
parse the xml by hand?
Thanks,
Simon
--
Simon Detheridge
SEN Developer, Widgit Software
This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com
Navigation:
[Reply to this message]
|