473,396 Members | 1,777 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 RequestStructure
public PartA as A
public PartB() as B
end structure

Public structure ResponseStructure
public ok as string
end structure

<webrequest()Public Function DoStuff(byval RequestStructure as
RequestStructure) as ResponseStructure
So, I have the following code:
dim myA as new com.xxx.xxx.xxx.etc.A
myA.a1="Test"
dim myRequestStructure as new com.xxx.xxx.xxx.etc.RequestStructure
myRequestStructure.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:
MyRequestStructure.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 MyRequestStructure.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 myRequestStructure.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 2729
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 RequestStructure
req.PartA = strucA
req.PartB = strArrB

etc..

Andrew
"craig" <cr***@vandenplas.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 RequestStructure
public PartA as A
public PartB() as B
end structure

Public structure ResponseStructure
public ok as string
end structure

<webrequest()Public Function DoStuff(byval RequestStructure as
RequestStructure) as ResponseStructure
So, I have the following code:
dim myA as new com.xxx.xxx.xxx.etc.A
myA.a1="Test"
dim myRequestStructure as new com.xxx.xxx.xxx.etc.RequestStructure
myRequestStructure.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:
MyRequestStructure.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 MyRequestStructure.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 myRequestStructure.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.xxxx.B
end Class

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

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).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 RequestStructure
req.PartA = strucA
req.PartB = strArrB

etc..

Andrew
"craig" <cr***@vandenplas.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 RequestStructure
public PartA as A
public PartB() as B
end structure

Public structure ResponseStructure
public ok as string
end structure

<webrequest()Public Function DoStuff(byval RequestStructure as
RequestStructure) as ResponseStructure
So, I have the following code:
dim myA as new com.xxx.xxx.xxx.etc.A
myA.a1="Test"
dim myRequestStructure as new com.xxx.xxx.xxx.etc.RequestStructure
myRequestStructure.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:
MyRequestStructure.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 MyRequestStructure.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 myRequestStructure.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
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="...">...
0
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...
2
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...
0
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...
6
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...
0
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...
4
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...
1
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...
0
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
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...
0
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,...

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.