DataReader in a web service

K

krammai

You cannot return a SqlDataReader from a Web Service. This
is a stream based object which cannot be serialized to
cross machines boundaries over SOAP. You can use the
DataSet instead.
 
M

Microsoft

Hello and Greetings,

Dear David:


Well what you can do instead of using dataset (as it is heavy) just have the
datareader stream packed in some object that could be crossed over using web
services. I usually convert all my complex types into a string
implementation and at the other end (Webservice client) I convert it back.
It works for most of my implementations, though I have never tried to do
this with a datareader but I guess you can do it. Give it a try and reply
back with the results.



Remember there is a slight disadvantage attached to this practice. As such
implantations can only work with custom clients. It sort of beats the
underlying principle of universal interpretably of the web services.



Another option could be using Remoting if the scenario allows it.



By the datasets are heavy but you would have to agree that they are best way
to send large amounts of data (specifically relational data), as it is has
many options built into it and is natively supported by the Webservices.



Also don't forget to read the doc mentioned below on MSDN:



- Consuming a DataSet from an XML Web Service



J, Happy Coding


Take Care,

Rai Umair - .NET Question? .NET Answer! http://www.raiumair.com
 

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

Top