Monday, November 25, 2013

SOAP vs REST

I was in a discussion the other day with someone questioning REST over SOAP and why on earth one would use REST rather than SOAP. Following are some thoughts on the matter.So, firstly, the idea of remote execution is not new. RPC harkens back to at least 1976, described in a formal manner in RFC 707, where messages were initiated by a client to a different address space, usually on another network computer. There has been a steady evolution of remote execution function call specifications, and with the advent of the web, there, ofc, came a host of web service protocols, designed to work with web transports and systems. SOAP and REST are but two of these, albeit probably the most widespread by far.

SOAP

SOAP comes from the bowels of XML-RPC, which was done way back in 1998. SOAP once stood for Simple Object Access Protocol but this was dropped with v1.3 of the standard, being blessed on June 24, 2003. SOAP was born of Microsoft, based on WSDL and UDDI. WSDL and UDDI have faded, but SOAP has much of its DNA in these specs. SOAP is currently owned by the W3C.
SOAP message model
SOAP characteristics:
  • Exposes operations that represent logic
  • provides a loose coupling for integrating diverse systems
  • designed to be extensible with the raft of WS-* specifications
  • Designed for distributed computing
  • Has a standard error messaging and error types
  • Aligns with EA requirements in that it supports various transports, e.g. HTTP, SMPT, UDP, JMS, etc.
  • supports enterprise security with WS-Security
  • supports language neutrality (you can use it with JAVA, Python, Ruby, Lisp, Perl, PHP, C, C#, etc.)
  • is ACID when using WS-AT
  • With WS-RM supports reliable messaging
  • Has strong typing, so supports strong governance
  • broadly supported in the industry

REST

REST was developed in parallel with HTTP/1.1. The largest implementation of a REST system is something called with WWW. REST works on a server-client conceptual basis, again, with clients initiating requests to servers, which process and return responses. This request / response paradigm is built upon the transfer of resource representations. A RESTFUL approach is not limited to HTTP, by the way. But, an example of HTTP yields the REST verbs (read methods from an OOP paradigm), URIs, Internet media types, request and response codes, etc. Here is a maintained list of REST examples.
Importantly, there are constraints on a design to maintain its RESTFUL nature. These are meant to be helpful, constraining forces:
  1. Client-server
  2. Stateless
  3. Cacheable
  4. Layered System
  5. Uniform interface – decouples architecture to allow client and server to evolve independently
  6. Code on demand (optional) – a server can pass logic to a client that may be executed, e.g. javascript or (shudder) applets.

Comparison

  • REST exposes resources that represent data, while SOAP exposes operations that represent logic
  • REST uses VERBS (Methods: GET/POST/DELETE) while SOAP uses the one verbPOST
  • REST emphasises simple p2p communication over HTTP, while SOAP emphasised loosely coupled distributed messaging
  • REST supports multiple data formats, while SOAP encodes everything in XML with data attachments
  • REST emphasises stateless communication while SOAP supports stateless and stateful operations
  • SOAP is better at asynchronous messaging, pub/sub and has strong typing (in the WSDL)

Strengths

REST has benefits because:
  • REST can be consumed by any client, even a web browser using Ajax and .js
  • REST is lightweight. Doesn’t require XML parsing, consumes less BW, doesn’t require a SOAP header for each message
  • REST is very widespread and highly adopted by many web resources
  • REST can be made very safe, since one can filter on anything that is not a GET verb.
  • Great for web services, exposing data over the internet.
  • Great for low BW and CPU requirements.
  • Great for combining data from multiple sources in a browser.
SOAP has benefits also:
  • SOAP will allow for custom exception codes, will allow for client side artefacts from a WSDL, has strong support in many IDEs
  • SOAP is much easier to use for stateful, asynchronous designs
  • SOAP is considered more secure by many because parameters are encoded in the message, not the URI. SOAP has support for contracts, acquiring tokens, etc. Note that REST doesn’t require params in the URI, but it often happens. Many would argue that this is breaking REST.
  • SOAP has reliability as part of its contract, e.g. WS-RM
  • SOAP can be governed more easily, it can be discovered more easily
  • Great for enterprise applications requiring contracts and reliability measures.
  • Great for asynch processing
Many from the EA camp would argue that SOAP is more reliable, safe, secure, but if that is the case, how is the WWW working? Again, remember that the largest REST system in existence is the web. And that’s pretty impressive. Most of the modern web enterprises are exposing their data and services in REST and SOAP, but more and more in REST.
Twitt

4 comments:

oakleyses said...

louis vuitton handbags, oakley sunglasses, louboutin, longchamp outlet, nike shoes, louis vuitton outlet stores, chanel handbags, burberry outlet, prada outlet, jordan shoes, tiffany and co, michael kors outlet, tory burch outlet, louis vuitton outlet, longchamp handbags, nike free, true religion jeans, michael kors outlet, kate spade outlet, polo ralph lauren outlet, tiffany and co, prada handbags, polo ralph lauren outlet, michael kors outlet, michael kors outlet, longchamp handbags, oakley sunglasses, ray ban sunglasses, kate spade handbags, burberry outlet, louis vuitton outlet, louboutin outlet, louboutin, coach factory outlet, air max, air max, coach outlet, gucci outlet, christian louboutin shoes, michael kors outlet, coach purses, ray ban sunglasses, michael kors outlet, louis vuitton, coach outlet store online, true religion jeans, oakley sunglasses cheap

oakleyses said...

ralph lauren, lululemon, air max, hollister, north face, nike air max, polo lacoste, vanessa bruno, timberland, vans pas cher, louboutin, louis vuitton, oakley pas cher, air max pas cher, nike roshe run, air max, true religion outlet, barbour, sac longchamp, air force, hollister, sac louis vuitton, nike free, polo ralph lauren, nike trainers, louis vuitton uk, nike roshe, sac hermes, longchamp, michael kors, sac burberry, sac guess, mulberry, new balance pas cher, converse pas cher, sac louis vuitton, hogan outlet, nike tn, north face, true religion outlet, ray ban pas cher, michael kors, air jordan, nike blazer, nike free pas cher, michael kors pas cher, abercrombie and fitch, ray ban sunglasses

oakleyses said...

mac cosmetics, mont blanc, marc jacobs, canada goose outlet, nike huarache, vans shoes, soccer jerseys, hollister, giuseppe zanotti, beats by dre, abercrombie and fitch, longchamp, insanity workout, celine handbags, bottega veneta, ghd, nfl jerseys, north face outlet, chi flat iron, ugg boots, birkin bag, ugg australia, canada goose, herve leger, ugg pas cher, rolex watches, valentino shoes, canada goose uk, canada goose, ferragamo shoes, canada goose, ugg boots, uggs outlet, north face jackets, soccer shoes, asics running shoes, new balance shoes, p90x, lululemon outlet, canada goose jackets, mcm handbags, instyler, babyliss pro, ugg, wedding dresses, jimmy choo outlet, reebok outlet, nike roshe run

oakleyses said...

parajumpers, karen millen, air max, converse, pandora charms, moncler, louboutin, moncler, links of london, lancel, juicy couture outlet, oakley, hollister, pandora charms, supra shoes, thomas sabo, canada goose, gucci, wedding dresses, timberland boots, swarovski crystal, air max, coach outlet store online, moncler, ray ban, canada goose, moncler, ugg, louis vuitton, swarovski, hollister, montre homme, moncler, hollister clothing store, ralph lauren, rolex watches, moncler outlet, moncler, iphone 6 cases, baseball bats, juicy couture outlet, toms shoes, vans, pandora jewelry, ugg, converse shoes