473,800 Members | 2,731 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Soap Request containing an array?


I'm fried on this problem...It's vb.net, dealing with a web service
that requires input as an array of a particular data structure and I
can't get the code to compile or run...

Basically, the webservice is showing me the following:
Public structure A
public a1 as string
end structure

Public structure B
public b1 as string
public b2 as string
end structure

Public structure RequestStructur e
public PartA as A
public PartB() as B
end structure

Public structure ResponseStructu re
public ok as string
end structure

<webrequest()Pu blic Function DoStuff(byval RequestStructur e as
RequestStructur e) as ResponseStructu re
So, I have the following code:
dim myA as new com.xxx.xxx.xxx .etc.A
myA.a1="Test"
dim myRequestStruct ure as new com.xxx.xxx.xxx .etc.RequestStr ucture
myRequestStruct ure.PartA=myA
(so far, so good)

dim myB(10) as new com.xxx.xxx.xxx .etc.B
results in a syntax error "Arrays cannot be declared with new". Ok, so
I'll take out "new". It compiles, but, I then get an "object reference
not set to an instance of an object" error later on when I attempt to
put data into myB.

So, I changed the dim to:
dim myB as arraylist
and then, each time I put something in, I put it in as a structure in
the form of structure B.

But, that creates a problem when I get to the actual web service call,
since I cannot say:
MyRequestStruct ure.PartB=MyB
because MyB is an arraylist, not of type B. There probably is a way to
make this work, by pulling out the individual items in the arraylist,
but I've tried several dozen seemingly clever ways to assign the data
to MyRequestStruct ure.PartB and it either doesn't pass syntactically,
or it blows up with an "object reference..." error.

So, I figured I'd create my own, local, structure containing the B
structure from the webservice. That doesn't work, since I can't assign
my local structure to myRequestStruct ure.PartB because they are
technically 2 different types.

So, I figured I'd create a local structure containing the B structure
inside it. That's basically the same as the ArrayList solution, and
has the same problems.

I thought "createinstance " would be the solution, but I haven't had
any success in getting that to work with a structure defined in a web
service.

I've looked all over the place trying to find ANY example of anyone
ever passing a structure and have found NONE. Surely, someone has done
this without brute-force coding it as discrete xml instead of a soap
call...

And, I have NO control over the webservice at the other end.

Craig
Aug 3 '06 #1
2 2787
Hi Craig,

It looks like the only problem you have is creating an array of structure
B... would something like the following work?

Dim strucA as new structureA
strucA.a1 = "structureA "

'Create an empty array of structureB's
Dim strucArrB(1) as structureB

'set first element in the array
strArrB(0) = new structureB
strArrB(0).b1 = "test"
strArrB(0).b2 = "test"

'set the second element in the array
strArrB(1) = new structureB
strArrB(1).b1 = "test"
strArrB(1).b2 = "test"

Dim req as new RequestStructur e
req.PartA = strucA
req.PartB = strArrB

etc..

Andrew
"craig" <cr***@vandenpl as.comwrote in message
news:cj******** *************** *********@4ax.c om...
>
I'm fried on this problem...It's vb.net, dealing with a web service
that requires input as an array of a particular data structure and I
can't get the code to compile or run...

Basically, the webservice is showing me the following:
Public structure A
public a1 as string
end structure

Public structure B
public b1 as string
public b2 as string
end structure

Public structure RequestStructur e
public PartA as A
public PartB() as B
end structure

Public structure ResponseStructu re
public ok as string
end structure

<webrequest()Pu blic Function DoStuff(byval RequestStructur e as
RequestStructur e) as ResponseStructu re
So, I have the following code:
dim myA as new com.xxx.xxx.xxx .etc.A
myA.a1="Test"
dim myRequestStruct ure as new com.xxx.xxx.xxx .etc.RequestStr ucture
myRequestStruct ure.PartA=myA
(so far, so good)

dim myB(10) as new com.xxx.xxx.xxx .etc.B
results in a syntax error "Arrays cannot be declared with new". Ok, so
I'll take out "new". It compiles, but, I then get an "object reference
not set to an instance of an object" error later on when I attempt to
put data into myB.

So, I changed the dim to:
dim myB as arraylist
and then, each time I put something in, I put it in as a structure in
the form of structure B.

But, that creates a problem when I get to the actual web service call,
since I cannot say:
MyRequestStruct ure.PartB=MyB
because MyB is an arraylist, not of type B. There probably is a way to
make this work, by pulling out the individual items in the arraylist,
but I've tried several dozen seemingly clever ways to assign the data
to MyRequestStruct ure.PartB and it either doesn't pass syntactically,
or it blows up with an "object reference..." error.

So, I figured I'd create my own, local, structure containing the B
structure from the webservice. That doesn't work, since I can't assign
my local structure to myRequestStruct ure.PartB because they are
technically 2 different types.

So, I figured I'd create a local structure containing the B structure
inside it. That's basically the same as the ArrayList solution, and
has the same problems.

I thought "createinstance " would be the solution, but I haven't had
any success in getting that to work with a structure defined in a web
service.

I've looked all over the place trying to find ANY example of anyone
ever passing a structure and have found NONE. Surely, someone has done
this without brute-force coding it as discrete xml instead of a soap
call...

And, I have NO control over the webservice at the other end.

Craig


Aug 7 '06 #2

No, that actually doesn't work. The reason being that structure B is a
derived structure from a web service.

I *did* find the solution, however.

Define a new class, for example:
Class MyNewClass
public shared MyBStructre(100 ) as com.xxxx.xxxx.x xxx.B
end Class

Then, in the actual code, you can do the following:
dim MyLocalB as new MyNewClass.MyBS tructure

Craig

On Mon, 7 Aug 2006 11:46:37 +0100, "Andrew Brook" <yk****@hotmail .com>
wrote:
>Hi Craig,

It looks like the only problem you have is creating an array of structure
B... would something like the following work?

Dim strucA as new structureA
strucA.a1 = "structureA "

'Create an empty array of structureB's
Dim strucArrB(1) as structureB

'set first element in the array
strArrB(0) = new structureB
strArrB(0).b 1 = "test"
strArrB(0).b 2 = "test"

'set the second element in the array
strArrB(1) = new structureB
strArrB(1).b 1 = "test"
strArrB(1).b 2 = "test"

Dim req as new RequestStructur e
req.PartA = strucA
req.PartB = strArrB

etc..

Andrew
"craig" <cr***@vandenpl as.comwrote in message
news:cj******* *************** **********@4ax. com...
>>
I'm fried on this problem...It's vb.net, dealing with a web service
that requires input as an array of a particular data structure and I
can't get the code to compile or run...

Basically, the webservice is showing me the following:
Public structure A
public a1 as string
end structure

Public structure B
public b1 as string
public b2 as string
end structure

Public structure RequestStructur e
public PartA as A
public PartB() as B
end structure

Public structure ResponseStructu re
public ok as string
end structure

<webrequest()P ublic Function DoStuff(byval RequestStructur e as
RequestStructu re) as ResponseStructu re
So, I have the following code:
dim myA as new com.xxx.xxx.xxx .etc.A
myA.a1="Test "
dim myRequestStruct ure as new com.xxx.xxx.xxx .etc.RequestStr ucture
myRequestStruc ture.PartA=myA
(so far, so good)

dim myB(10) as new com.xxx.xxx.xxx .etc.B
results in a syntax error "Arrays cannot be declared with new". Ok, so
I'll take out "new". It compiles, but, I then get an "object reference
not set to an instance of an object" error later on when I attempt to
put data into myB.

So, I changed the dim to:
dim myB as arraylist
and then, each time I put something in, I put it in as a structure in
the form of structure B.

But, that creates a problem when I get to the actual web service call,
since I cannot say:
MyRequestStruc ture.PartB=MyB
because MyB is an arraylist, not of type B. There probably is a way to
make this work, by pulling out the individual items in the arraylist,
but I've tried several dozen seemingly clever ways to assign the data
to MyRequestStruct ure.PartB and it either doesn't pass syntactically,
or it blows up with an "object reference..." error.

So, I figured I'd create my own, local, structure containing the B
structure from the webservice. That doesn't work, since I can't assign
my local structure to myRequestStruct ure.PartB because they are
technically 2 different types.

So, I figured I'd create a local structure containing the B structure
inside it. That's basically the same as the ArrayList solution, and
has the same problems.

I thought "createinstance " would be the solution, but I haven't had
any success in getting that to work with a structure defined in a web
service.

I've looked all over the place trying to find ANY example of anyone
ever passing a structure and have found NONE. Surely, someone has done
this without brute-force coding it as discrete xml instead of a soap
call...

And, I have NO control over the webservice at the other end.

Craig

Aug 9 '06 #3

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

Similar topics

1
13877
by: The Grand Admiral | last post by:
Question. I have a wsdl soap request structure as follows: <soap:Envelope xmlns:xsi="..." xmlns:xsd="..." xmlns:soap="..."> <soap:Header>... </soap:Header> <soap:Body> <SaveItem xmlns="..."> <ItemXml>xml</ItemXml> <PropertyView>string</PropertyView>
0
3736
by: ramas | last post by:
Hi, I am new to PHP scripting and i am trying to connect to a soap server (as mentioned below) using the SOAP extension comesup with PHP. Now my requirement is to add my HTTP header fields along with my SOAP request, so that the SOAP server will receive it and does some high level processing. Is it possible to add our own HTTP header fields in PHP? If i use the header() function to add the field into the HTTP header and it neither...
2
15452
by: Paul Hale | last post by:
I have a vb.net web service and client that are both working fine. If someone wanted to consume our web service using .NET, no problem. Im a little confused on how non .NET clients would use the web service though. Question 1: Does Java etc have some kind of SOAP tool kit developers could use to access our web service? Question 2: .NET conveniently shows what the serialized xml looks like and what the web service expects (Please see...
0
1948
by: Kaimar Seljamäe | last post by:
Hi, I have to create a web service client which uses SOAP encoding but does not use "multi-reference" values (see http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383513 item 10). If I create SOAP client like this: public class StockService : SoapHttpClientProtocol {
6
4761
by: Stephen | last post by:
I've got a problem with a PHP program that i've written using the standard SOAP client with a WSDL file. When calling one of the functions on the SOAP server i'm occasionally receiving a response containing a pound sign encoded as &pound;. This causes my program to report 'Looks like we got no XML document' and not process the response. The SOAP server is provided by a third party and appears to be Perl SOAPLite. They insist that the...
0
1810
by: Naoum Naoumov | last post by:
So I have a gsoap server and a PHP soap client and I am trying to return a list (vector) of objects to the PHP client. However, the client seems to only store the last element of the array ... Any ideas on how to solve that? $rs = $client->get( new SoapParam($request, "request") , new SoapParam($response, "response" ) ); print_r($rs); REQUEST: <?xml version="1.0" encoding="UTF-8"?<SOAP-ENV:Envelope
4
2488
by: Joseph Geretz | last post by:
We use a Soap Header to pass a token class (m_Token) back and forth with authenticated session information. Given the following implementation for our Logout method, I vastly prefer to simply code m_Token = null in order to destroy the session token when the user logs out. However, I'm finding that setting class instance to null results in no header being sent back to the client, with the result that the client actually remains with an...
1
4790
by: pmasclark | last post by:
Hello, I created a web site, site A, that redirects to another web site, site B, where a simple web service is hosted. The code to call the web service is simple. oWS.AllowAutoRedirect = True oWS.Credentials = New System.Net.NetworkCredential("user","pass") str = oWS.HelloWorld("World")
0
2480
by: kim123 | last post by:
I got to write a c# client will ask a SOAP::Lite server for a list of data. In the request I have to send the following attributes: string, string, array, string, string The SOAP:Lite server is on a UNIX box and there is no wsdl file for me to use. My c# code looks like this: class TestApp {
0
9690
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
9551
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
10504
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...
1
10251
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
10033
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7576
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
6811
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4149
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
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.