|
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!
Navigation:
[Reply to this message]
|