Web Service API REST vs Soap

SOAP (Simple Object Access Protocol) has been dominant approach to web service interfaces for a long time, but REST (Representational State Transfer) is winning out and now represents more than 70% of public web services APIs.

RESTs sweet spot is the point at which you are uncovering an open API over the internet to handle CRUD operations on data. REST is focused on accessing named resources through a single reliable interface.

SOAP presents it’s own protocol and focuses on uncovering pieces of application logic (not data) as services. SOAP exposes operations. SOAP is centered around accessing named operations, each implement some business logic through various interfaces.

Why Use SOAP?
While SOAP supports SSL (like REST) it likewise supports WS-Security which adds some enterprise security features.

Atomic Transactions
Need ACID Transactions over a service, you’re going to use SOAP. While REST supports transactions, it isn’t as comprehensive or ACID compliant.

Reliable Messaging
Rest doesn’t have a standard messaging framework and expects clients to deal with communication failures by retrying. SOAP has successful/retry meganicism built in and provides end-to-end reliability even through SOAP intermediaries.

Why Use REST?
Since REST utilizes standard HTTP it is much simpler in pretty much ever way

REST allows many different data formats where as SOAP only allows XML.

REST has much better performance and scalability. REST reads can be cached where SOAP based reads cannot be cached.

Google, Yahoo & most companies use REST