<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>//TODO: Create Blog Title &#187; Web Services</title>
	<atom:link href="http://DontForgetYourTODOs.com/tag/web-services/feed/" rel="self" type="application/rss+xml" />
	<link>http://DontForgetYourTODOs.com</link>
	<description></description>
	<lastBuildDate>Mon, 26 Jul 2010 03:20:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Backwards Compatible Web Services</title>
		<link>http://DontForgetYourTODOs.com/2008/05/backwards-compatible-web-services/</link>
		<comments>http://DontForgetYourTODOs.com/2008/05/backwards-compatible-web-services/#comments</comments>
		<pubDate>Sat, 31 May 2008 22:26:39 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://tucholski.wordpress.com/?p=3</guid>
		<description><![CDATA[I do a lot of work in distributed environments using service-oriented architectures. One of our biggest projects just launched, and at the time only had one client (Client A) consuming the web service. Now as the number of clients grows, the test is on to make sure we built the service as intended and any [...]]]></description>
			<content:encoded><![CDATA[<p>I do a lot of work in distributed environments using service-oriented architectures.  One of our biggest projects just launched, and at the time only had one client (<em>Client A</em>) consuming the web service.  Now as the number of clients grows, the test is on to make sure we built the service as intended and any number of clients that need its functionality can use it without requiring major changes.</p>
<p>We&#8217;ve already run into a problem trying to make our second version of the web service backwards compatible, and unfortunately it is going to require the first client to update to the new WSDL.  In the first version of the web service, one of our objects had a string property called <em>AccountNumber</em>.  Now the <em>Client B</em> is integrating they require this existing object to support an array of <em>AccountNumber</em>.  We had a couple of different options for how to approach this so that <em>Client A</em> was not affected:</p>
<ol>
<li>Add the <em>AccountNumbers</em> property with no other modifications.</li>
<li>Add the <em>AccountNumbers </em>property and mark the original <em>AccountNumber </em>property with the <strong>Obsolete</strong> attribute.</li>
<li>Make the <em>AccountNumber </em>setter point to the first index in the new <em>AccountNumbers</em> property.</li>
</ol>
<p><strong>Option 1</strong> is the easiest, but for a new client offers the most confusion as they may not understand the difference between the two properties.  The responsibility is also on the service now to determine which property was intended to be used or if both are supplied, which one takes precedence.  <strong>Option 2</strong> which I thought would be the best option, as that is the route to take when designing class libraries, actually surprised me.  When marking a property obsolete, it is actually removed from the WSDL thus any client who provides that value is providing additional information that the WSDL doesn&#8217;t define.  At this point, that was not going to work as well.  <strong>Option 3</strong> seemed it would also work good until I ran some unit tests and was having problems nullifying out the values.  Once again the responsibility was up to the service to determine which value would be accepted if both happened to be supplied.  What happens if the object was sent to the web service with the <em>AccountNumber</em> property set to a value and the 0th index in the <em>AccountNumbers</em> property set to null?  The result depends on the order of serialization/de-serialization.</p>
<p>What option did we ultimately take out?  We caved and dropped the <em>AccountNumber</em> property and implemented the new <em>AccountNumbers </em>property, requiring our client to update their version of the WSDL so that they could comply with our service.</p>
<p>What defines a web service as a backwards compatible web service?  This happens when:</p>
<ul>
<li>new methods are added to the service</li>
<li>restrictions are removed (access restrictions, mandatory values are now optional, etc.)</li>
<li>optional attributes and properties are added</li>
<li>attributes are changed but their type is compatible with the previous type (number to string)</li>
</ul>
<p>Herein lies the complication with building web services and making sure that you design so that further down the road you don&#8217;t require all of your existing clients to change to adapt to your updates.  Fortunately for us, there was only one existing client, so this change is much more possible.</p>
]]></content:encoded>
			<wfw:commentRss>http://DontForgetYourTODOs.com/2008/05/backwards-compatible-web-services/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
