Here is few parameters you can consider based on your requirement when choosing type of Web Services

1. Formats of Data

REST supports different formats like text, JSON and XML;  
SOAP only supports XML;

2. Transport Layer

REST works only over HTTP(S) on a transport layer;
SOAP can be used different protocols on a transport layer like HTTP(s), SMTP, UDP etc;

3. Possible way of Access

REST works with resources, each unique URL is some representation of a resource;
SOAP works with operations, which implement some business logic through different interfaces;

4. Caching

SOAP based reads can’t be cached, for SOAP need to provide caching;
REST based reads can be cached;

5. Security

SOAP supports SSL security and WS-security(Web Service-security);
REST only supports SSL security;

6. Transaction

SOAP supports ACID (Atomicity, Consistency, Isolation, Durability);
REST supports transactions, but it is neither ACID compliant nor can provide two phase commit.

REST vs SOAP” we can rephrased to “Simplicity vs Standard“. Of course, “Simplicity” with REST at most cases wins, it wins in performance, scalability and support for multiple data formats, but SOAP is favored where service requires comprehensive support for security (WS-security) and transactional safety (ACID).

Advertisements