473,473 Members | 1,994 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

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!
Nov 18 '07 #1
2 5831
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.comwrote:
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!
Nov 19 '07 #2
On Nov 19, 3:35 pm, petersprc <peters...@gmail.comwrote:
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.
Thank you very much, it works well!

On Nov 17, 10:07 pm, forcey <for...@gmail.comwrote:
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!
Nov 20 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: chr | last post by:
Hi, I'm trying to integrate a webservice into a c#-program, creating proxy classes from a wsdl-file with wsdl.exe. All works fine, except if containers are returned. Although I can see in the...
0
by: Michael Jackson | last post by:
I have attempted to mark up a service and it's methods so that it doesn't require the SOAPAction HTTP header to resolve the methods being called, this is done from first element in <SOAP-ENV:Body>...
3
by: parrot toes | last post by:
Summary: I have been trying to make requests of a web service provided by Axis using a dotnet client with code generated by wsdl.exe and have been getting exceptions when trying to process the...
0
by: Amar | last post by:
I am recieving the "The root element is missing" error from my soap extension while attempting to validate an incoming SOAP message request. I suspect the problem resides in the ChainStream method...
0
by: | last post by:
i just read through Axis user doc, but all sample app it mention doesn't show how to use the <HEADER> tag inside soap request / response. 1 -- is <HEADER> tag not much a use when doing 1 - 1 host...
3
by: jparulan | last post by:
Hi All, I'm using SOAP3.0. I was able to successfully call a WSDL file and get a value properly. But when the WSDL changed to have a MULTIPLE <element name> it was failing. This code works...
7
by: beachdog | last post by:
I'm using Visual Studio 2005/C# to build a web client. The web server is something I've written in a different framework, which does not support generating wsdl, so I have hand-built a wsdl file,...
4
by: gcharbon | last post by:
Hi community, I have a problem with a Soap client written in php. I have a local server (coded in c and a client in c too, it works fine), but i want to test client in php, and i have an error...
4
by: Nick Vargish | last post by:
Hi, I'm a little bit stuck trying to send a SOAP request that includes multiple occurrences of an element. For the sake of illustration, this is what the relevant portions of the SOAP request...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.