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

passing collection object to web service in .NET


I am developing an applocation which reads mails in outlook inbo
alongwith attachments and all these informmation is stored in
collection which i need to pass it to a web service, which will perfor
certain operations on that collection and then return that modifie
collection to the client.
but when i am trying to pass a simple collection of strings to my we
service it gives me an error "You must implement Add(System.Object) a
it inherits from IColletion".
Can someone tell me the exact way as to how i can pass collection t
and from a web service in VB.NET

Thanks in advanc
-
vbvjai
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
-----------------------------------------------------------------------

Nov 18 '05 #1
1 5671
I prefer using arrays and its collection-like counterpart, the
arraylist. When using an arraylist, you have the add and remove and
removeat methods, but the key for transferring between two objects is
the .ToArray and the .AddRange methods. The former converts the
arraylist into a literal array of objects. You can do it with Option
strict on too, but it's a bit more verbose:

dim x as dtoObject ' For illustration only
dim al as arraylist
dim obj as new webservice

obj.callingMethod(ctype(al.toarray(gettype(dtoObje ct)),dtoObject())

So what you're saying is convert the arraylist to array of type
dtoObject, but ToArray returns an object (subtype dtoObject()), so you
have to strong type it back to dtoObject()

Then when you receive it as an input parameter, its as simple as

public sub InMethod(dto() as dtoObject)
al.addrange(dto)
end sub

Hope that helps. It might not be the answer you wanted, but it is a
very easy technique that you should try. If you have a specific need to
use a Collection type, let me know and I'll clarify my answer.

vbvjain <vb************@mail.codecomments.com> wrote in
news:vb************@mail.codecomments.com:

I am developing an applocation which reads mails in outlook inbox
alongwith attachments and all these informmation is stored in a
collection which i need to pass it to a web service, which will
perform certain operations on that collection and then return that
modified collection to the client.
but when i am trying to pass a simple collection of strings to my web
service it gives me an error "You must implement Add(System.Object) as
it inherits from IColletion".
Can someone tell me the exact way as to how i can pass collection to
and from a web service in VB.NET

Thanks in advance

--
vbvjain
-----------------------------------------------------------------------
- Posted via http://www.codecomments.com
-----------------------------------------------------------------------
-


Nov 18 '05 #2

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

Similar topics

5
by: John Dewbert | last post by:
*** post for FREE via your newsreader at post.newsfeed.com *** Hello, I have trouble passing a folder object (from a FileSystemObject) to a sub procedure. Consider the following code: ...
3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
3
by: hellrazor | last post by:
Hi there, I'm trying to consume a web-service that is supposed to return a collection of a custom object. The web-service was not created with C# or VS.net. It was created with IBM VisualAge...
1
by: vbvjain | last post by:
Hi Thanks for your suggestion, i even tried that but now the error that is generated is "There was an error generating XML". If i declare the input parameter of my web service method as object and...
1
by: Guest | last post by:
I wish to pass a collection object to a web service method in VB.NET, but when i try to do so i get an error message that "There was an error generating the XML", i even tried the XMLSerializer, but...
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...
9
by: Greger | last post by:
Hi, I am building an architecture that passes my custom objects to and from webservices. (Our internal architecture requires me to use webservices to any suggestion to use other remoting...
6
by: nickname | last post by:
I want to pass some xml to a web service method, the xml will confirm to a defined schema. Lets say the schema is defined as: <xs:schema attributeFormDefault="unqualified"...
2
by: =?Utf-8?B?Y3Nz?= | last post by:
I am new to ASP.net webservice and have a quesiton. Is is possible to pass custom object to a web service (using VB 2005)? My custom object will look like this Public Class Myclass Public...
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: 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: 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...
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,...

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.