Returning ArrayList from WebServices

Discussion in 'ASP .Net Web Services' started by Ashish Saxena via .NET 247, Apr 8, 2005.

  1. Hi all

    public System.Data.DataSet GetDataSetParam(string sProcName,ArrayList aParameterName, ArrayList aParameterValue)
    {

    when i m calling from my windows application then its givin me error that
    collection.arraylist can not be converted to object..but i m writting same peice of code in my windows function its working fine.


    please suggest me the way how to pass & return the arraylist ..

    Thx & regards,


    From: Ashish Saxena

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>Nw41ck19Xk2bRmyHQ3STPA==</Id>
    Ashish Saxena via .NET 247, Apr 8, 2005
    #1
    1. Advertising

  2. Ashish Saxena via .NET 247

    Brock Allen Guest

    Return an array instead. ArrayList is a class in .NET that has no meaning
    to your interop client (java, perl, C++, VB6).

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > Hi all
    >
    > public System.Data.DataSet GetDataSetParam(string sProcName,ArrayList
    > aParameterName, ArrayList aParameterValue)
    > {
    > when i m calling from my windows application then its givin me error
    > that collection.arraylist can not be converted to object..but i m
    > writting same peice of code in my windows function its working fine.
    >
    > please suggest me the way how to pass & return the arraylist ..
    >
    > Thx & regards,
    >
    > From: Ashish Saxena
    >
    > -----------------------
    > Posted by a user from .NET 247 (http://www.dotnet247.com/)
    > <Id>Nw41ck19Xk2bRmyHQ3STPA==</Id>
    >
    Brock Allen, Apr 8, 2005
    #2
    1. Advertising

  3. Ashish Saxena via .NET 247

    Krishna Guest

    You could use CollectionBase for passing strongly typed
    collections from web services. The proxy class then
    converts this to an array.

    public class Apples : System.Collections.CollectionBase
    {
    public void Add(Apple apple)
    {
    this.InnerList.Add(apple);
    }

    public Apple this[int index]
    {
    get { return (Apple ) this.InnerList
    [index]; }
    set { this.InnerList[index] = value; }
    }
    }

    public class Apple
    {
    public string countryoforigin;
    public string colour;
    }
    Krishna, Apr 11, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Saravanan Rathinavelu

    Iterate through ArrayList using an another ArrayList

    Saravanan Rathinavelu, Aug 16, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    2,738
    Natty Gur
    Aug 19, 2003
  2. Kaidi
    Replies:
    4
    Views:
    2,375
    Kaidi
    Jan 3, 2004
  3. xz
    Replies:
    16
    Views:
    2,368
  4. Philipp
    Replies:
    6
    Views:
    925
    Arne Vajhøj
    May 28, 2008
  5. Mario Rodriguez

    problems returning ArrayList from webServices

    Mario Rodriguez, Apr 12, 2004, in forum: ASP .Net Web Services
    Replies:
    5
    Views:
    163
    Jan Tielens
    Apr 15, 2004
Loading...

Share This Page