473,378 Members | 1,401 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,378 software developers and data experts.

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 1405

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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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:
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...

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.