Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Passing collection as input parameter to web service

Reply
Thread Tools

Passing collection as input parameter to web service

 
 
Guest
Guest
Posts: n/a
 
      10-21-2004
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/)
 
Reply With Quote
 
 
 
 
Bechmann
Guest
Posts: n/a
 
      10-21-2004
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/)
>

 
Reply With Quote
 
 
 
 
Dan Rogers
Guest
Posts: n/a
 
      11-12-2004
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$(E-Mail Removed)>
>Newsgroups: microsoft.public.dotnet.framework.aspnet.webservic es
>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!TK2MSFT NGP08.phx.gbl!TK2MSFTNGP10
.phx.gbl
>Xref: cpmsftngxa10.phx.gbl

microsoft.public.dotnet.framework.aspnet.webservic es:26194
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservic es
>
>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/)
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Collection problems (create Collection object, add data to collection, bind collection to datagrid) yvind Isaksen ASP .Net 1 05-18-2007 09:24 AM
passing collection object to web service in .NET vbvjain ASP .Net 0 10-27-2004 12:13 PM
passing collection object to web service in .NET vbvjain ASP .Net 0 10-26-2004 05:33 AM
passing collection object to web service in .NET vbvjain ASP .Net 1 10-25-2004 09:24 AM
passing collection object to web service in .NET vbvjain ASP .Net 0 10-19-2004 06:52 AM



Advertisments