HighTechTalks DotNet Forums  

wcf and returning a datatable

ASP.net Web Services microsoft.public.dotnet.framework.aspnet.webservices


Discuss wcf and returning a datatable in the ASP.net Web Services forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
dave
 
Posts: n/a

Default wcf and returning a datatable - 11-19-2007 , 02:51 PM






i have a working wcf service and am having problems returning a datatable
from the wcf service.
I am able to return properties and collections of objects however when
returning a datatable i am getting a returned type of
'CheckListResponseCheckListResult' (where checklist is the name of the
function that returns the datatable)

testing code below
Dim stmp As WF374WCF.CheckListResponseCheckListResult =
svc.CheckList(97)
Console.WriteLine(stmp.Any)

stmp.any is an xmlelement (which appears to have the schema information but
i have yet to find the data (rows) within the return object.

How do i get the datatable rehydrated on the client site?

thank you
dave





Reply With Quote
  #2  
Old   
Tiago Halm
 
Posts: n/a

Default Re: wcf and returning a datatable - 12-06-2007 , 05:37 PM






A datatable is serialized via .NET Serialization, and you're building a
WebService where the standard serialization (optimized for SOAP
interoperability scenarios) is used. The standard serialization applies to
simple types or complex types decorated with DataContract attribute.
DataTable is not a simple type.

The datatable serialization is not universal, is only .NET specific. You
would be better off creating a DataContract with the expected struct the
DataTable contains and return a List<MyStruct>.

Tiago Halm

"dave" <dave (AT) discussions (DOT) microsoft.com> wrote

Quote:
i have a working wcf service and am having problems returning a datatable
from the wcf service.
I am able to return properties and collections of objects however when
returning a datatable i am getting a returned type of
'CheckListResponseCheckListResult' (where checklist is the name of the
function that returns the datatable)

testing code below
Dim stmp As WF374WCF.CheckListResponseCheckListResult =
svc.CheckList(97)
Console.WriteLine(stmp.Any)

stmp.any is an xmlelement (which appears to have the schema information
but
i have yet to find the data (rows) within the return object.

How do i get the datatable rehydrated on the client site?

thank you
dave







Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.