views:

143

answers:

4

I understand RESTful is an architecture style, but what exactly makes SOAP-based web service not count for RESTful?

It's not clear to me which points below (from Wikipedia), is not conformed by SOAP.

  1. Client-server
  2. Stateless
  3. Cacheable
  4. Layered system
  5. Code on demand (optional)
  6. Uniform interface
    • Identification of resources
    • Manipulation of resources through these representations
    • Self-descriptive messages
    • Hypermedia as the engine of application state

EDIT: I just came across this which summaries it pretty well.

REST is not RPC, RPC says, "define some methods that do something" whereas REST says, "define some resources and they will have these methods". It is a subtle but vital difference, when given a URI anyone knows they can interact with it via the predefined set of methods and receive standard HTTP responses in return. So given http://www.peej.co.uk/ I know I can issue a GET on it and receive something meaningful back. I may then try a PUT on it to change it and receive a meaningful HTTP error code since I'm not authorised to meddle with it.

+2  A: 

REST conforms to nothing more than the http protocol.

Pierreten
+4  A: 

SOAP follows the RPC pattern. A SOAP API describes a series of methods, along with their parameters and return values, that you can call from your code. There's a marshaling step that converts this into it's network representation.

REST is never RPC. A REST API describes a series of resources, along with a set of verbs (typically HTTP's GET, POST, PUT, DELETE) that can act on them.

To answer your question directly: SOAP primarily violates point 6 (it doesn't provide a uniform set of verbs across APIs). It also violates point 2 (the server can maintain state for each client), and as a result point 3 as well (state prevents caching).

Trevor Johns
+1  A: 

One of the objectives of REST is cachability, for that the resource needs to be identified by the uri (query string). In soap the request is posted, therefor for different requests you have the same uri and thus the resource cannot be uniquely identified by the ur

Piotr Zolnierek
+5  A: 

REST and SOAP are not equivalent concepts.

REST:

  • One fixed transport protocol (HTTP).
  • Makes full use of the specific features of that protocol (verbs GET, POST, PUT, DELETE, and caching).
  • Says nothing about the format of the messages passed back and forth. However, since the HTTP verb already defines the action to take, the message body must therefore contain only the data.
  • Message security is provided by the transport protocol (HTTPS), and is point-to-point only. If you want to secure the message end-to-end, you have to do it yourself.
  • Originally intended for simple CRUD operations on objects.

SOAP:

  • Says nothing about the transport protocol (could theoretically be HTTP, raw TCP, FTP or even email if you wanted to go mad).
  • Requires only that the transport protocol be able to send and receive text (e.g. on HTTP, only the POST verb is used).
  • Strictly defines the format of the messages passed back and forth. A SOAP message defines both the data and the action to perform on it.
  • Message security is provided by the WS-* standards, and is end-to-end.
  • Originally intended for arbitrary RPC calls.

Items 2 and 3 in the above lists are the main points of incompatibility.

Christian Hayter