How to pass an arraylist filled with a list of objects to a web service and retrive the arraylist back from the client side

Dear Experts,

I created two applications web application (ASP.NET 2.0) and web service. I want to fill an arraylist with a list of objects (Customer Class) then a want to pass it to the web service. In the web service I want to process the list of objects and returned them to the web application as an arraylist of objects also.

I tried to do it many time but unfortunately every time I end up with failure.

Please how can I accomplish such behavior?

Thank you  
SamijfAsked:
Who is Participating?
 
SamijfConnect With a Mentor Author Commented:
Thank you for your response.

Is there is any sample by VB.Net and please I want know how to pass a custom collection as parameter to the web service and also how to receive it back in the consumer client if passable.

Because my scenario is as follow

I need to pass a list of custom objects to the web service which I can include in the custom collection as the solution explained in the link provided (C# sample) then I want to process them there and return them back to consumer client as a custom collection.

Thank again.
Sami
0
 
Gyanendra SinghArchitectCommented:
You cannot actually pass an actual ArrayList or other .NET object to a web service.
Web Services communicate via XML that is described by XML Schema which is referred to by a WSDL file.  None of these things is capable of describing an ArrayList or any other .NET type.
Web Services are meant to be platform-neutral. How would another platform be able to interpret an ArrayList if it were actually sent?

Refer this link if you want to pass collection
http://geekswithblogs.net/WayneMagnum/archive/2008/01/24/custom-collection-parameter-in-a-web-service.aspx

but dont forget to add serilized attribute in your class
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.