Passing collection as input parameter to web service

Discussion in 'ASP .Net Web Services' started by Guest, Oct 21, 2004.

  1. Guest

    Guest Guest

    Hi All !! I need to pass a collection(of complex objects) to webservice method for some processing at web service, but it givesme error "There was an error generating XML" when i try to passcollection as an input paramter to web service. Can anyone tellmehow i can pass collection object to web service. Thanks inadvance.
    User submitted from AEWNET (http://www.aewnet.com/)
     
    Guest, Oct 21, 2004
    #1
    1. Advertising

  2. Guest

    Bechmann Guest

    Hi

    Pass your objects as an array instead - that will do the trick

    Bechmann

    "Guest" wrote:

    > Hi All !! I need to pass a collection(of complex objects) to web service method for some processing at web service, but it gives me error "There was an error generating XML" when i try to pass collection as an input paramter to web service. Can anyone tell mehow i can pass collection object to web service. Thanks in advance.
    > User submitted from AEWNET (http://www.aewnet.com/)
    >
     
    Bechmann, Oct 21, 2004
    #2
    1. Advertising

  3. Guest

    Dan Rogers Guest

    Hi,

    The XmlSerializer needs to know the types that it will encounter in your
    collection. The collection itself is fine, but you need to add an
    XmlInclude attribute to your method call, one for each type that the
    serializer will encounter when it goes to serialize the collection. The
    data in the objects in the collection will have to be serializable types.

    On the server side, the web service will need to expect an array of inputs
    or a custom collection definition. Generally, one should build the calling
    interface from a description of the server's interface. On the wire there
    is little difference between a collection and an array, so usually you can
    use a collection as a parameter anywhere you would expect to see an array,
    and vice versa.

    Regards

    Dan Rogers
    Microsoft Corporation
    --------------------
    >From: Guest <Guest@aew_nospam.com>
    >X-Newsreader: AspNNTP 1.50 (aewnet.com)
    >Subject: Passing collection as input parameter to web service
    >Mime-Version: 1.0
    >Content-Type: text/plain; charset="us-ascii"
    >Content-Transfer-Encoding: quoted-printable
    >Message-ID: <Ogfyq$>
    >Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
    >Date: Wed, 20 Oct 2004 22:36:28 -0700
    >NNTP-Posting-Host: 63.161.67.173
    >Lines: 1
    >Path:

    cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10
    .phx.gbl
    >Xref: cpmsftngxa10.phx.gbl

    microsoft.public.dotnet.framework.aspnet.webservices:26194
    >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
    >
    >Hi All !! I need to pass a collection(of complex objects) to web service

    method for some processing at web service, but it gives me error "There was
    an error generating XML" when i try to pass collection as an input paramter
    to web service. Can anyone tell mehow i can pass collection object to web
    service. Thanks in advance.
    >User submitted from AEWNET (http://www.aewnet.com/)
    >
     
    Dan Rogers, Nov 12, 2004
    #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. vbvjain
    Replies:
    0
    Views:
    445
    vbvjain
    Oct 19, 2004
  2. vbvjain
    Replies:
    1
    Views:
    903
    Pradeep Kumar C
    Oct 25, 2004
  3. vbvjain
    Replies:
    0
    Views:
    323
    vbvjain
    Oct 26, 2004
  4. vbvjain
    Replies:
    0
    Views:
    316
    vbvjain
    Oct 27, 2004
  5. Øyvind Isaksen
    Replies:
    1
    Views:
    999
    Øyvind Isaksen
    May 18, 2007
Loading...

Share This Page