all groups > dotnet web services > october 2004 >
You're in the

dotnet web services

group:

Is it possible to return a DataTable from a Webservice method


Is it possible to return a DataTable from a Webservice method ganga NO[at]SPAM spectradata.co.nz
10/31/2004 5:06:37 PM
dotnet web services:
Hi All,

I was just wondering whether is it possible to return a Data Table
from a WebService method. Since I need to send only one table at a
time, I dont want to return the entire Dataset.

Any help would be highly appreciated.

Cheers

Re: Is it possible to return a DataTable from a Webservice method Sami Vaaraniemi
11/1/2004 9:34:43 AM
No, it is not possible to return a DataTable from a web service. You will
need to wrap it inside a DataSet.

See http://support.microsoft.com/default.aspx?scid=kb;en-us;306134

Regards,
Sami

[quoted text, click to view]

Re: Is it possible to return a DataTable from a Webservice method Stuart Celarier
11/2/2004 12:22:47 AM
[quoted text, click to view]

Yes, that Knowledge Base article advocates returning a DataSet from a Web
service. However that should be considered a poor practice from a
service-orientation perspective. One of the tenets of service-orientation is
that services share contract and schema ... and nothing else. Passing a
DataSet between Web services violates this tenet, and the result is that it
will only work so long as both endpoints are always .NET platforms.

A better solution would be to pass entity data that is domain- or
business-specific. Not a DataTable, but a set of data that has an actual XSD
schema generated in the WSDL for the Web services so that it can be used by
clients on any platform.

Cheers,
Stuart Celarier, Fern Creek

AddThis Social Bookmark Button