RE: Passing collection as input parameter to web service

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Dan Rogers (danro_at_microsoft.com)
Date: 11/12/04


Date: Fri, 12 Nov 2004 00:18:03 GMT

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$ytEHA.1296@TK2MSFTNGP10.phx.gbl>
>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/)
>



Relevant Pages

  • RE: Ajax AutoCompleteExtender is Auto-Calculating
    ... You must add apostrophe symbol before and after string inserted in web ... service array. ... AutoCompleteExtender is not the data that resides in the database, ... data being returned by the web service the AutoCompleteExtender consumes. ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • RE: Interesting Problem With WebService results and Repeater Control
    ... The array of items is probably setting up the item class to have fields ... exposed directly instead of properties (which the form binding requires). ... you need to make the proxy use a class that exposes the data ... I have written a web service to provide some back-end functionality to a Web ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Stumped - Strongly Typed Arrays question (with simplified code example)
    ... You can put the array in an ArrayList, ... > When done without a web service, ... > public class ItemCollection: CollectionBase ... int index) ...
    (microsoft.public.dotnet.framework.webservices)
  • RE: Array support in Web Services
    ... Ulrich, Denmark ... > type and pass it to the web service through the request message. ... > returns an array of bytes if you'd like. ... >>Ulrich, Denmark ...
    (microsoft.public.biztalk.general)
  • Stumped - Strongly Typed Arrays question (with simplified code example)
    ... encapsulates a private member with a strongly-typed custom array (that ... When done without a web service, ... public class ItemCollection: CollectionBase ... public void CopyTo(ItemitemArray, int index) ...
    (microsoft.public.dotnet.framework.webservices)