<?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>biotext.org.uk &#187; soap</title>
	<atom:link href="http://biotext.org.uk/tag/soap/feed/" rel="self" type="application/rss+xml" />
	<link>http://biotext.org.uk</link>
	<description>Not a typewriter</description>
	<lastBuildDate>Sat, 05 Feb 2011 14:18:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>SOAP vs REST &#8212; a common misconception?</title>
		<link>http://biotext.org.uk/soap-vs-rest-a-common-misconception/</link>
		<comments>http://biotext.org.uk/soap-vs-rest-a-common-misconception/#comments</comments>
		<pubDate>Sat, 03 Jan 2009 14:38:02 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Rants]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[soap]]></category>
		<category><![CDATA[webservices]]></category>

		<guid isPermaLink="false">http://biotext.org.uk/?p=85</guid>
		<description><![CDATA[Update (1-Nov-09): Since writing this post nearly a year ago, I&#8217;ve come to realise that I was labouring under quite a few misconceptions myself, about REST. Spotting them all is left as an exercise for the reader. But I&#8217;d rather leave it here with this caveat, than remove it and pretend I knew better all [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update (1-Nov-09): Since writing this post nearly a year ago, I&#8217;ve come to realise that I was labouring under quite a few misconceptions myself, about REST. Spotting them all is left as an exercise for the reader. But I&#8217;d rather leave it here with this caveat, than remove it and pretend I knew better all along&#8230;</strong></p>
<p>Michael Little at Fliquid Studios recently posted <a href="http://www.fliquidstudios.com/2008/12/17/soap_vs_rest_api/">an interesting comparison of SOAP vs REST</a> which may have accidentally perpetuated a misconception about SOAP that I believe is fairly common. This post is a response to that and a expanded version of a comment I left on Michael&#8217;s site.</p>
<p>The confusion arises from the difference between the communication layer (SOAP) and the databinding layer (aka marshalling/unmarshalling) which is responsible for mediating between language-native data structures and XML. Michael is writing from a PHP point of view, and I&#8217;m not sure what PHP SOAP toolkits are like in this regard, but fortunately in the Java world the distinction between the two is made clear, and we have various options for each &#8212; although JAX-WS for SOAP and JAXB for databinding are the <a href="http://java.sun.com/webservices/technologies/index.jsp">industry standard specifications</a>.</p>
<p><span id="more-85"></span></p>
<p>For example, Michael says:</p>
<blockquote><p>&#8230; the way the PHP SoapServer class handles arrays of data is (or was last time I checked) incompatible with the way an ASP.NET SOAP client handles them&#8230;</p></blockquote>
<p>While this may well be true, it&#8217;s also somewhat tangential to a general discussion of the differences between SOAP and REST, and seems to chime with a sentiment I&#8217;ve detected elsewhere that REST is easier because it&#8217;s &#8216;just XML&#8217; &#8212; or whatever other method for structuring the data you choose to use instead. The translation of XML data into arrays is the responsibility of the databinding layer, and nothing to do with SOAP <em>per se</em>. Incompatibilities between different approaches to marshalling and unmarshalling would also be an issue if one wanted to use a databinding layer over REST.</p>
<p>Databinding is not part of the SOAP spec. At their heart, SOAP messages are also just XML documents, exactly like REST, and there&#8217;s always the option of parsing the XML yourself, exactly as you would with REST. We do this extensively in the <a href="http://funcnet.eu/">FuncNet</a> project, for performance reasons. It can also be useful, as Michael&#8217;s article indirectly suggests, for sidestepping compatibility issues &#8212; because every language can read/write XML.</p>
<p>You can even use SOAP to send/receive arbitrary non-XML data, e.g. via attachments or CDATA or large strings&#8230; e.g. plain text, JSON etc. <a href="http://soaplab.sourceforge.net/soaplab2/">Soaplab2</a> for example sends the results of SOAP-wrapped programs as-is, as large chunks of text.</p>
<p>Michael replied to me that his article &#8220;is intended to be related to the practical implementation of SOAP/REST in PHP&#8221;, but I thought it worth expanding on this point nonetheless, as he does also mention at the start that the content is hopefully useful to developers of other languages. Any decent SOAP service toolkit should give you the option to receive the whole request as XML, and/or generate raw XML for the response yourself. The same is true (in reverse obviously) for SOAP clients. These features are something worth checking for before committing to one stack or another, where a &#8216;stack&#8217; includes not just the SOAP libraries themselves but the language and environment that they&#8217;re built on. Tight coupling between a communication layer and a databinding layer isn&#8217;t a good sign and might, as Michael&#8217;s note about of SoapServer shows, reduce your interoperability options.</p>
<p>So if you are developing services that parse and generate XML directly, what advantage is there to using SOAP and WSDL over the simpler REST approach? Well, many SOAP/WSDL features are unrelated to databinding, for example mature tool support, schema validation, formally-defined contracts with documentation right down to the level of individual parameters, automatic service discovery via registries, and semantic annotation with extensions like SAWSDL. But more importantly, just because you may not be using databinding on the server side, doesn&#8217;t mean your consumers can&#8217;t.</p>
<p>Of course there are benefits to REST too, primarily ease of development, simplicity and elegance, and lower overhead &#8212; important if you&#8217;re sending/receiving lots of small messages. And there&#8217;s nothing to stop you using databinding technology to marshal or unmarshal REST messages too. It&#8217;s important to remember REST and SOAP are both essentially protocols for sending and/or receiving documents, and in that sense, they aren&#8217;t really all that different.</p>
]]></content:encoded>
			<wfw:commentRss>http://biotext.org.uk/soap-vs-rest-a-common-misconception/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

