<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Web service and custom serialization</title>
	<atom:link href="http://www.mattberther.com/2006/05/17/web-service-and-custom-serialization/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mattberther.com/2006/05/17/web-service-and-custom-serialization/</link>
	<description>Agile Manager and Occasional Code Monkey</description>
	<lastBuildDate>Sun, 21 Feb 2010 22:01:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Steve Maine</title>
		<link>http://www.mattberther.com/2006/05/17/web-service-and-custom-serialization/comment-page-1/#comment-1009</link>
		<dc:creator>Steve Maine</dc:creator>
		<pubDate>Sat, 20 May 2006 16:06:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattberther.com/blog/?p=755#comment-1009</guid>
		<description>For the record, this story gets a lot better in Indigo. The DataContractSerializer supports [Serializable], ISerializable, [DataContract] and IXmlSerializable, and you can mix and match the various serialization models within the same object graph.
</description>
		<content:encoded><![CDATA[<p>For the record, this story gets a lot better in Indigo. The DataContractSerializer supports [Serializable], ISerializable, [DataContract] and IXmlSerializable, and you can mix and match the various serialization models within the same object graph.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Berther</title>
		<link>http://www.mattberther.com/2006/05/17/web-service-and-custom-serialization/comment-page-1/#comment-1008</link>
		<dc:creator>Matt Berther</dc:creator>
		<pubDate>Thu, 18 May 2006 02:26:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattberther.com/blog/?p=755#comment-1008</guid>
		<description>Havagan: It wasnt necessarily that I was married to the idea of this coming back using the SOAP formatter. I just wanted to avoid having a default public constructor on my business classes.

Don: As always, you make a perfectly valid argument. I think this is probably what we&#039;ll end up doing.</description>
		<content:encoded><![CDATA[<p>Havagan: It wasnt necessarily that I was married to the idea of this coming back using the SOAP formatter. I just wanted to avoid having a default public constructor on my business classes.</p>
<p>Don: As always, you make a perfectly valid argument. I think this is probably what we&#8217;ll end up doing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Don Demsak</title>
		<link>http://www.mattberther.com/2006/05/17/web-service-and-custom-serialization/comment-page-1/#comment-1007</link>
		<dc:creator>Don Demsak</dc:creator>
		<pubDate>Thu, 18 May 2006 00:01:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattberther.com/blog/?p=755#comment-1007</guid>
		<description>I&#039;d suggest that you have 2 copies of the &quot;objects&quot;, even though you think it stinks.  You have to remember that even though the &quot;objects&quot; have the same name, they are actually built to accomplish 2 different goals.  The class that you have now, it is a business object, and thus has to conform to your business rules (which is part of the reason why you don&#039;t have a default constructor).  Business classes contain the business data and the business behaviors.  On the other hand, you have this representation of your business object that you wish to pass along the wire.  The representation is a message, and not a business object.  This class will contain a representation of the data contained within the business object, but as it is a message, it contains no business rules. 

Once you decouple the message from the business object, you will have an easier time distinguishing between your core business rules, and your message rehydration rules.  In do so, you are also better able to handle versioning of your public facing contracts (in web services this is done via WSDL and XML Schema).  You can now update and change your business objects as needed, and only add any new data to your message when that new functionality is required.  By going down this path you will also be able to utilize the more enterprise friendly Web Services Contract First approach to building web services.

I know that there are a lot of people that will disagree with me, and feel as you do, that by splitting things into messages and business objects, you are just adding to the bloat of a system, but I’ve learned that as long as you don’t hit the architectural issues that you discuss here, that yes, the message based methodology is overkill for your particular project.  But once you start to see that there is differences between the way you want to implement the business object, and the way you want to represent it on the wire, then you need to start to think about going down the message path.

A comprising between these 2 designs is to implement the IXmlSerializable interface, on your business classes, but eventually this will also become too cumbersome and you will have to go the route of the message methodology, especially when you have to handle multiple minor versions of your message coming thru the same web service.</description>
		<content:encoded><![CDATA[<p>I&#8217;d suggest that you have 2 copies of the &#8220;objects&#8221;, even though you think it stinks.  You have to remember that even though the &#8220;objects&#8221; have the same name, they are actually built to accomplish 2 different goals.  The class that you have now, it is a business object, and thus has to conform to your business rules (which is part of the reason why you don&#8217;t have a default constructor).  Business classes contain the business data and the business behaviors.  On the other hand, you have this representation of your business object that you wish to pass along the wire.  The representation is a message, and not a business object.  This class will contain a representation of the data contained within the business object, but as it is a message, it contains no business rules. </p>
<p>Once you decouple the message from the business object, you will have an easier time distinguishing between your core business rules, and your message rehydration rules.  In do so, you are also better able to handle versioning of your public facing contracts (in web services this is done via WSDL and XML Schema).  You can now update and change your business objects as needed, and only add any new data to your message when that new functionality is required.  By going down this path you will also be able to utilize the more enterprise friendly Web Services Contract First approach to building web services.</p>
<p>I know that there are a lot of people that will disagree with me, and feel as you do, that by splitting things into messages and business objects, you are just adding to the bloat of a system, but I’ve learned that as long as you don’t hit the architectural issues that you discuss here, that yes, the message based methodology is overkill for your particular project.  But once you start to see that there is differences between the way you want to implement the business object, and the way you want to represent it on the wire, then you need to start to think about going down the message path.</p>
<p>A comprising between these 2 designs is to implement the IXmlSerializable interface, on your business classes, but eventually this will also become too cumbersome and you will have to go the route of the message methodology, especially when you have to handle multiple minor versions of your message coming thru the same web service.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Havagan</title>
		<link>http://www.mattberther.com/2006/05/17/web-service-and-custom-serialization/comment-page-1/#comment-1006</link>
		<dc:creator>Havagan</dc:creator>
		<pubDate>Wed, 17 May 2006 21:18:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattberther.com/blog/?p=755#comment-1006</guid>
		<description>I rarely use XML so this is a shot in the dark... how about using the XMLTypeMapping to specificy the XML output should conform to SOAP format?

&lt;a href=&quot;http://www.topxml.com/xmlserializer/customizing_xml_serialization.asp&quot; rel=&quot;nofollow&quot;&gt;http://www.topxml.com/xmlserializer/customizing_xml_serialization.asp&lt;/a&gt;
&lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/system.xml.serialization.xmltypemapping.aspx&quot; rel=&quot;nofollow&quot;&gt;http://msdn2.microsoft.com/en-us/library/system.xml.serialization.xmltypemapping.aspx&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>I rarely use XML so this is a shot in the dark&#8230; how about using the XMLTypeMapping to specificy the XML output should conform to SOAP format?</p>
<p><a href="http://www.topxml.com/xmlserializer/customizing_xml_serialization.asp" rel="nofollow">http://www.topxml.com/xmlserializer/customizing_xml_serialization.asp</a><br />
<a href="http://msdn2.microsoft.com/en-us/library/system.xml.serialization.xmltypemapping.aspx" rel="nofollow">http://msdn2.microsoft.com/en-us/library/system.xml.serialization.xmltypemapping.aspx</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
