Passing collection as input parameter to web service

G

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/)
 
D

Dan Rogers

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: <[email protected]>
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top