tags:

views:

80

answers:

2

Why does soap use its envolope messages? And why Restful doesn't? They all use HTTP (post,get etc.) , don't they? What is the real difference between soap and restful?

+3  A: 

SOAP vs. REST [ XML/HTTP ] :The Web Services debate.

* SOAP *

Pros:

  • Langauge, platform, and transport agnostic
  • Designed to handle distributed computing environments
  • Is the prevailing standard for web services, and hence has better support from other standards (WSDL, WS-*) and tooling from vendors
  • Built-in error handling (faults)
  • Extensibility

Cons:

  • Conceptually more difficult, more "heavy-weight" than REST
  • More verbose
  • Harder to develop, requires tools

* REST *

Pros:

  • Language and platform agnostic
  • Much simpler to develop than SOAP
  • Small learning curve, less reliance on tools
  • Concise, no need for additional messaging layer
  • Closer in design and philosophy to the Web

Cons:

  • Assumes a point-to-point communication model--not usable for distributed computing environment here message may go through one or more intermediaries
  • Lack of standards support for security, policy, reliable messaging, etc., so services that have more sophisticated requirements are harder to develop ("roll your own")
  • Tied to the HTTP transport model
rahul
I'd argue about "harder to develop, requires tools". If you have the tools, then it's not harder to develop. Similarly, REST with no tools is harder to develop than SOAP _with_ tools, since you have to build your XML or JSON yourself (possibly leveraging serialization), whereas you don't have to do that if using tools.
John Saunders
REST isn't tied to HTTP, but HTTP is meant to be used in a RESTful manner - it's an architectural style, not a protocol or architecture. The REST style is no more tied to HTTP than the RPC style was to ONC RPC. That's also why your other cons don't apply - they're cons of HTTP, not the REST style, which isn't to say that REST doesn't have cons, and they're even listed in Roy Fielding's thesis.
Keith Gaughan
I wanna talk about Soap has better support from other standards (WSDL, WS-*) and tooling from vendors. Isn't soap use WSDL? Then how could it be better support than WSDL.And what is the difference between architecture and architectural style? What do you mean? I thought that Restful is an architecture.
Iguramu
The difference between an architecture and an architectural style is reification: an architecture is an architectural style made concrete. For example, take the gothic style of building architecture - the architecture of Reims Cathedral is in this style, i.e., the plans for the cathedral are the architecture, and so the plans are a concrete example of the gothic style. Reims Cathedral itself is a further reification of those plans - the same plans/architecture could be used for multiple identical cathedrals.I hope that's clear. 600 character's isn't much for explaining this stuff!
Keith Gaughan
point-to-point communication model?
Iguramu
+1  A: 

HTTP is the envelope in RESTful HTTP. SOAP tunnels over HTTP and pretty much ignores everything HTTP has to offer, which is why it has its own envelope.

Keith Gaughan
Then why Soap was thought first? Why people didn't think Restful at first? Isn't it easier to implement?
Iguramu
I'm not sure if it can really be said that one came before the other. The REST style is a formalism of the architectural style found in HTTP, and Roy Fielding's work started in 1996 (RFC1945), and his thesis was published in 2000. The SOAP spec was published in 2000, but SOAP is really just another RPC mechanism, and the essentials of RPC go back to 1976 and RFC707.It's really just that the idea of RPC falls naturally out of trying to impose the familiar mechanism of procedure calls on network communication, whereas REST grew out of a protocol for with massively distributed communication.
Keith Gaughan