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

Home Posts Topics Members FAQ

Need help passing object array to Web service

This might be a stupid question, but I'd appreciate any help you could offer.
I'm trying to pass an array of objects back to a Web service.

The Web service expects this:

Dim Recipients() as WS.Recipient

but it won't let me create an object array of this type directly, so I'm
creating an ArrayList object and using CType to convert it, like so:

Dim WS as <my Web service>
Dim notification As New WS.Notification
Dim recipient As New WS.Recipient

Dim recipientList As New ArrayList

recipient.Name = "NameGoesHere"
recipient.Type = WS.AclType.User
recipientList.Add(recipient)
With Notification
.Message = "Test Message"
.Subject = "Test Subject"
.Recipients = CType(recipientList.ToArray, WS.Recipient())
End With

I get a "specified cast is not valid" error when it runs, but it seems to work
in the debugger; I get this from the debugger when I pause it before the
offending line:

? ctype(recipientList.ToArray, WS.Recipient())
{Length=1}
(0): {WinFormsTestArea.WS.Recipient}

So it seems to be giving me what I want. What am I doing wrong?
Jul 21 '05 #1
0 1410

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

Similar topics

4
by: Mark Rae | last post by:
Hi, Can anyone please tell me if it's possible to pass a System.Web.Mail.MailMessage object to a ASP.NET Web Service? Maybe using XML Serialization / Deserialization? I've been asked to...
0
by: Roger Bonine | last post by:
This might be a stupid question, but I'd appreciate any help you could offer. I'm trying to pass an array of objects back to a Web service. The Web service expects this: Dim Recipients() as...
3
by: SQLScott | last post by:
I have looked all over and I cannot find an example or information on passing a multi-dimensional array. Well, that is not true. I found a close example in C++ but it didn't work when I...
11
by: John Pass | last post by:
Hi, In the attached example, I do understand that the references are not changed if an array is passed by Val. What I do not understand is the result of line 99 (If one can find this by line...
0
by: Roger Bonine | last post by:
This might be a stupid question, but I'd appreciate any help you could offer. I'm trying to pass an array of objects back to a Web service. The Web service expects this: Dim Recipients() as...
3
by: GBR | last post by:
I have a collection object inherited from collection base that is used to carry my object entities from server to client through a web service. I want to add a dataset to this collection object and...
12
by: Noel | last post by:
Hello, I'm currently developing a web service that retrieves data from an employee table. I would like to send and retrieve a custom employee class to/from the webservice. I have currently coded...
10
by: amazon | last post by:
Our vender provided us a web service: 1xyztest.xsd file... ------------------------------------ postEvent PostEventRequest ------------------------------------- authetication authentication...
7
by: TS | last post by:
I was under the assumption that if you pass an object as a param to a method and inside that method this object is changed, the object will stay changed when returned from the method because the...
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
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
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
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
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,...
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
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 ...

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.