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

Posted on 2008-11-12
Last Modified: 2012-05-05
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  
Question by:Samijf
    LVL 16

    Expert Comment

    by:Gyanendra Singh
    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

    but dont forget to add serilized attribute in your class

    Accepted Solution

    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.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now