Blogger :
DonXML
All posts :
All posts by DonXML
Category :
WS, web services
Blogged date : 2006 Feb 12
There has been quite a commotion on some of the private discussion/newsgroup and sending Datasets or Data Tables via web services. So much so, that I think I need to say it again, Send Messages Not Serialized Object Graphs. The usual offers of this rule seem to be under the influence of a number of Visual Studio 2005 presentations, and extend what they have learned via these presentations to web services. A typical post looks like this:
I've seen a number of presentations on VS2005 and Framework 2.0 that emphasizes the new shiny role of the DataTable type. Indeed, there's a new DataTable designer, typed DataTables and typed DataAdapters. So far, so good. Then, there are claims that DataTable is supposed to be serializable as well, like the DataSet in version 1.X. An obvious use of this serialization is in a WebService (I know something can be "serializable" but not XML-serializable, but nowadays those things are almost interchangeable -blame the marketing guys).
If you find yourself falling under the trance of the presenter’s spell, remember my words: DO NOT SEND DATASETS OR THEIR KIN THRU WEBSERVICES!
I can't make it any clearer then that. Sending datasets or their kin is #1 on the Things Not To Do With Web Services List. If you are using web services it is all about interop with different platforms, thus the other side will have no clue what a "Dataset" is. If you control both sides of the wire, use remoting or WCF. What you send over a webservice is a Message and its format is expressed thru XML-Schema. A DataTable or a DataSet is an object, not a message. A message has data and format, but no behaviors, an object has all three. Web Services is all about crossing explicit boundaries. To get more info on this, please read Werner Vogels’ “Web Services are not Distributed Objects”.
I know Microsoft has made it easy to bind to Datasets, and that is fine for RAD applications, but once you jump to web services, you really need to think about what you are doing more, because you have to worry about things like explicit contracts and versioning.
Oh, I’ll be giving a Intro To Web Services presentation at the March, 2006 Central New Jersey .Net User Group where I’ll explain the concept of sending messages in gory detail.
Technorati Tags: web services datasets