Jeremy Miller posted a reply to my Intro to Web Services post/presentation entitled Pragmatic viewpoints on SOA, where he questions coding WSDL by hand, but agrees with my stance on decoupling the message contract from the business object. A lot of the content from my talk isn’t embedded in the presentation, so some things may be a little vague. No, I’d never, ever recommend coding WSDL by hand. It screams for a tool to build it, and the WSCF tool I mentioned is a perfect for this. But, I do promote spending as much time as possible on designing the actual message contract itself (i.e. the XML Schemas).
In the comments Jeremy talks about using XML serialization attributes to control the serialization of his Data Transfer Objects. I did have a question on DTOs at the code camp, and my comment/opinion is that Data Transfer Objects are a type of message. A message conveys only data and structure, and has no behaviors. A business object has both data and behavior. The example I gave in the class was that of writing a letter. The letter contains a message, and it is up to the receiver of the message to read and comprehend the message. If the letter isn’t written correctly, or uses words that reader doesn’t understand, there is no way for the sender to correct the problem. The message has no control over how it is used. I write blogs to help me practice my writing skills, since I’ve noticed that I can have problems getting my message across to readers that don’t know me (there is implicit information missing from my message which causes the reader to misinterpret it), thus the subtitle of the presentation “It’s All about the Message”.
The funny thing about Jeremy’s title, “Pragmatic Viewpoints on SOA” was that during the presentation I did bring up the Don Box Pramatics post, and said that I don’t care if you use Code First or Contract First, as long as you pay attention to the message, and ship a product.
Yes, Datasets are also a form of Data Transfer Objects, but unlike other DTOs, they abide by their own contract which is driven from their relational legacy (which is roughly two dimensional) and are only useful when the receiver of the message understands the Dataset contract. So do not use Datasets as a replacement for messages sent via web services.