Pragmatics
Someone recently asked me about how to handle an internal product debate around REST vs. SOAP.
In hopes I never have to address this debate again, here's a record of what I told them.
The following design decisions are orthogonal, even though people often conflate two or more of them:
1. Whether one uses SOAP or POX (plain-old-XML).
2. Whether or not one publishes an XML schema for their formats.
3. Whether or not one generates static language bindings from an XML schema.
4. The degree to which one relies on HTTP-specific features. That stated, screw with GET at your peril.
5. Whether one adopts a message-centric design approach or a resource-centric design approach.
Some of the decisions (specifically 5) are architectural and sometimes philosophical.
Some of the decisions (specifically 1-2) are simple business decisions that are determined by who your target audience is.
I think one of the things that I find a little frustrating in this debate is this fundamentally arrogant attitude that SOAP-oriented developers have that REST programmers are incompetents who utilize poor programming practices rather than using the "enlightened" approach of SOAP/WSDL, instead of being competent programmers who have looked carefully at both approaches and realized that while both have their place (and I will readily admit that they do) the REST approach actually offers significant larger-scale benefits over SOAP in the areas that are relevant to them.
Don continues:
1. If you want a great experience for .NET/Java devs, youll typically publish schemas (through wsdl) and support SOAP.
2. If you want a great experience for LAMP folks, youll support POX messages and will provide a non-XSD description of your formats.
3. If you want to reach both audiences, youll do both #1 and #2.
4. If you want to reach both audiences before your competition does, you'll avoid indulging in religious debates and ship something.
Finally, I think there's a subtle point here (alluding to attitudes discussed earlier). While its easy to couch the arguments about approaches in religious terms (religious debates, evangelism, etc.), what is in question here is which approach is the best for the job at hand, not which approach is the more morally correct. This is an architectural decision, one based upon the needs and requirements of the customers, the competencies of the developers and the resources available to complete the job. If my requirements are to build an office building and the tools that you are offering are best suited to building cathedrals, I'd be hesitant to use those tools if ones that are more suited to office building construction are available.
SOAP and REST are not equivalent strategies, nor do they represent the "skilled" vs. the "unskilled" approach. Each has a specific domain where it has its strengths and should be used in that domain, just as each has its domain where it is weakest and should be carefully evaluated before being used in that other space. They are not even orthogonal - I think there are domains where you want to be able to offer both, where the two overlap, typically in those spaces where you are able to establish a "semi-trusted" perimeter. As application development moves into the realm of large-scale distributed applications where you likely do not own all of the nodes within the network, determining those boundaries and the appropriate tools will become one of the key differentiation points between the successful and the bankrupt.
Kurt Cagle is Director for New Technologies and Training with Mercurial Communications in Victoria, British Columbia, and is the author of multiple books on Web technologies, XML, SVG and AJAX. He is also the Chairman of the SVG Open 2006 Conference.
Kurt Cagle is an author and writer specializing in XML, Web 2, SVG, and blogging.
oreillynet.com Copyright © 2006 O'Reilly Media, Inc.