SOAP vs REST
- SOAP web services support RPC-Style and Message oriented style while REST is only RPC-Style.
- REST is closely tied to HTTP while SOAP is transport independent and can be used with HTTP, Messaging, e-mail, UDP, etc.
- SOAP is XML oriented while REST allows multiple data formats like XML, JSON, HTML, text etc.
- REST reads can be easily cached thus performing better and scales easily. Also SOAP is more chatty thus using more bandwidth.
- On the security side, WS-security allows for a SOAP message to identify the caller, sign the message, and encrypt message contents. This allows SOAP message to be secure even when using non-secure transport like e-mail. Security in REST is only SSL using HTTPS transport.
- SOAP supports more complete transaction management using WS-AtomicTransaction.
- SOAP provides standard WS-ReliableMessaging framework while REST does not have any messaging framework and client is expected to recover from communication failures.
- SOAP makes it easy to generate native clients from a WSDL. REST requires you to write a client library for all platforms you wish to support. Or expect your users/integrators to do it for you.
- The multiple data formats makes REST more suitable for client-server use. For example, you can use AMF binary for Flash clients, or JSON for JavaScript clients. Both Flash and JavaScript engines are extremely slow at processing XML (SOAP).
- SOAP is a more RPC style, whereas REST is more resource oriented. REST works nicely with CRUD operations.
I tend to use REST for client-server, and SOAP for backend system to system integration.