473,788 Members | 2,733 Online
Bytes | Software Development & Data Engineering Community
+ 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:complexTyp e name="map_name_ balance">
<xsd:sequence >
<xsd:element name="username" type="xsd:strin g"></xsd:element>
<xsd:element name="balance" type="xsd:float "></xsd:element>
</xsd:sequence>
</xsd:complexType >

<xsd:complexTyp e name="array_map _name_balance">
<xsd:sequence maxOccurs="unbo unded">
<xsd:element name="map" type="tns:map_n ame_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 5864
Hi,

You can define a SOAP array:

The balance:

<xsd:complexTyp e name="nameBalan ce">
<xsd:sequence >
<xsd:element name="username" type="xsd:strin g"></xsd:element>
<xsd:element name="balance" type="xsd:float "></xsd:element>
</xsd:sequence>
</xsd:complexType >

Array of balances:

<complexType name="nameBalan ceArray">
<complexContent >
<restriction base="SOAP-ENC:Array">
<attribute ref="SOAP-ENC:arrayType"
wsdl:arrayType= "tns:nameBalanc e[]"/>
</restriction>
</complexContent>
</complexType>

The return value will be the expected result.

On Nov 17, 10:07 pm, forcey <for...@gmail.c omwrote:
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:complexTyp e name="map_name_ balance">
<xsd:sequence >
<xsd:element name="username" type="xsd:strin g"></xsd:element>
<xsd:element name="balance" type="xsd:float "></xsd:element>
</xsd:sequence>
</xsd:complexType >

<xsd:complexTyp e name="array_map _name_balance">
<xsd:sequence maxOccurs="unbo unded">
<xsd:element name="map" type="tns:map_n ame_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...@gmai l.comwrote:
Hi,

You can define a SOAP array:

The balance:

<xsd:complexTyp e name="nameBalan ce">
<xsd:sequence >
<xsd:element name="username" type="xsd:strin g"></xsd:element>
<xsd:element name="balance" type="xsd:float "></xsd:element>
</xsd:sequence>
</xsd:complexType >

Array of balances:

<complexType name="nameBalan ceArray">
<complexContent >
<restriction base="SOAP-ENC:Array">
<attribute ref="SOAP-ENC:arrayType"
wsdl:arrayType= "tns:nameBalanc e[]"/>
</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.c omwrote:
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:complexTyp e name="map_name_ balance">
<xsd:sequence >
<xsd:element name="username" type="xsd:strin g"></xsd:element>
<xsd:element name="balance" type="xsd:float "></xsd:element>
</xsd:sequence>
</xsd:complexType >
<xsd:complexTyp e name="array_map _name_balance">
<xsd:sequence maxOccurs="unbo unded">
<xsd:element name="map" type="tns:map_n ame_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
1638
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 returned xml that there are entries in the containers the proxy-classes say it is empty. Has anybody an idea why this is so an how to solve this problem -- the returned xml-data looks like this <?xml version="1.0"...
0
2296
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> and the request and responses are not suffixed with Request and Response. Is there some more I could do with the attributes on the class that defines the WS and on the methods. the code for the WS etc is below. This I can get to work POST...
3
9796
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 response. As a result of seraching news groups I guessed that the SOAP response defines an array element in a way that causes the dotnet deserialization routines to put the content in a generic object array (object) BUT the content is supposed to...
0
2938
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 but I'm not sure. Below is a water-downed version of the code that I'm working on. While debugging, I noticed that if I pass an invalid SOAP request, the schema validation catches it and throws the error appropriately. However, when I pass in a...
0
1261
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 to host request /response? 2 -- <HEADER> is only useful when soap massage need to pass multiple endpoints / hosts ? 3 -- Why most of the web services at www.xmethods.net don't use <HEADER> tag
3
11695
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 BEFORE: strCurrency = oSOAP.eServeSearch(CSTR(Request.Form("T1"))) until the WSDL file changed to have more <element name> T1 is just a field that accepts a STRING
7
5881
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, then created my proxy class by running wsdl.exe. The problem is that the SOAP message that the client generates contains an empty namespace for the parameters in my message, instead of the namespace I intended it to have. I am guessing it is...
4
12057
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 (I'm not sure to understand it...) : SoapFault exception: Method 'ns1:getMetadataRequest' not implemented: method name or namespace not recognized in beta_2/soap.php:26 Stack trace: #0 /root/src/rxtxws/beta_2/soap.php(26):...
4
10650
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 should look like: <SyncItems> <UserContext>
0
9656
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10370
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10177
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10113
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8995
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7519
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5538
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4074
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.