Reply to Re: SOAP problem: how to pass multiple occurrence of an element?

Your name:

Reply:


Posted by petersprc on 11/19/07 07:35

Hi,

You can define a SOAP array:

The balance:

<xsd:complexType name="nameBalance">
<xsd:sequence>
<xsd:element name="username" type="xsd:string"></xsd:element>
<xsd:element name="balance" type="xsd:float"></xsd:element>
</xsd:sequence>
</xsd:complexType>

Array of balances:

<complexType name="nameBalanceArray">
<complexContent>
<restriction base="SOAP-ENC:Array">
<attribute ref="SOAP-ENC:arrayType"
wsdl:arrayType="tns:nameBalance[]"/>
</restriction>
</complexContent>
</complexType>

The return value will be the expected result.

On Nov 17, 10:07 pm, forcey <for...@gmail.com> wrote:
> Hi all,
>
> I'm writing a SOAP server using the SOAP extension and I need to
> return an array_map_name_balance, which is defined in a WSDL file like
> this:
>
> <xsd:complexType name="map_name_balance">
> <xsd:sequence>
> <xsd:element name="username" type="xsd:string"></xsd:element>
> <xsd:element name="balance" type="xsd:float"></xsd:element>
> </xsd:sequence>
> </xsd:complexType>
>
> <xsd:complexType name="array_map_name_balance">
> <xsd:sequence maxOccurs="unbounded">
> <xsd:element name="map" type="tns:map_name_balance"></xsd:element>
> </xsd:sequence>
> </xsd:complexType>
>
> However, if I return an object like:
> stdClass Object
> (
> [map] => Array
> (
> [0] => stdClass Object
> (
> [username] => forcey
> [balance] => 13.83
> )
>
> [1] => stdClass Object
> (
> [username] => someone_else
> [balance] => -13.17
> )
> )
> )
>
> the server throws an exception: SOAP-ERROR: Encoding: object hasn't
> 'username' property. I also tried to return:
> Array
> (
> [0] => stdClass Object
> (
> [map] => stdClass Object
> (
> [username] => forcey
> [balance] => 13.83
> )
> )
>
> [1] => stdClass Object
> (
> [map] => stdClass Object
> (
> [username] => onelittlefox
> [balance] => -13.17
> )
> )
> )
>
> and the server complains that object hasn't a 'map' property. So what
> is the problem? How can I return the data?
>
> Thank you all!

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация