SOAP problem: how to pass multiple occurrence of an element?
am 18.11.2007 04:07:07 von forcey
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:
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!
Re: SOAP problem: how to pass multiple occurrence of an element?
am 19.11.2007 08:35:39 von petersprc
Hi,
You can define a SOAP array:
The balance:
Array of balances:
wsdl:arrayType="tns:nameBalance[]"/>
The return value will be the expected result.
On Nov 17, 10:07 pm, forcey 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:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> 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!
Re: SOAP problem: how to pass multiple occurrence of an element?
am 20.11.2007 04:57:59 von forcey
On Nov 19, 3:35 pm, petersprc wrote:
> Hi,
>
> You can define a SOAP array:
>
> The balance:
>
>
>
>
>
>
>
>
> Array of balances:
>
>
>
>
>
> wsdl:arrayType="tns:nameBalance[]"/>
>
>
>
>
> The return value will be the expected result.
>
Thank you very much, it works well!
> On Nov 17, 10:07 pm, forcey 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:
>
> >
> >
> >
> >
> >
> >
>
> >
> >
> >
> >
> >
>
> > 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!