DataReader in a web service

  • Thread starter Thread starter Dave O
  • Start date Start date
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.
 
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
 
Back
Top