DIFFERENCE – SOAP VS REST

There is lot of traction around the difference between the 2.  I have tried to capture as much difference as possible. Hope this helps

Definition :

SOAP:  Protocol specification for exchanging data between 2 endpoints

REST:  Architectural style for building client-server applications


SOAP

  • It is a Protocol
  • SOAP – Simple Object Access Protocol
  • Cant use REST as it is protocol
  • Use Service interface to expose business Logic
  • JAX-WS Java API for SOAP Web Service
  • SOAP define strict standards
  • Defines its own security called  WS-Security
  • Supports only XML message format
  • Less Preferred due to its complexity
  • Works in distributed enterprise env
  • Built-In error handling using faults
  • WS-ReliableMessaging – reliable delivery  of SOAP msg
  • Has Spec for state-full implementation
  • Uses WSDL
  • Reliable
  • Payload must comply to SOAP Schema
  • More Verbose
  • Platform and Language Agnostic
  • WS-Atomic Transaction supports distributed transaction

REST:

  • It is an Architectural Style
  • Representational state  transfer
  • Can use SOAP as it is a concept
  • Uses URI to expose business logic
  • JAX-RS is the java API for REST Web service
  •  No Strict Standards
  • REST depends on  HTTPS  Security
  •  Message format – XML, JSON,text,HTML, Custom
  •  Preferred due to its simplicity
  • Assumes point-point  communication
  • No Built-in error handling
  • No such support for reliable messaging
  • Follow Stateless Model
  • Uses WADL
  •  Not Reliable- HTTP DELETE can return OK status even if the  resource is not deleted
  •  No constraint on payload
  •  Less Verbose
  • No Support for distributed transaction

When it is appropriate to use SOAP or REST

SOAP :

  • When publishing complex API’s
  • When you need in-built support for transaction,security etc
  • For distributed applications
  • For Stateful operations
  • Not Cachable as it used POST request

REST:

  • For Mobile and PDA’s
  • Cloud computing
  • Less learning curve
  • API’s for CRUD
  • High Performance
  • For Stateless operations
  • Cachable and scalable

More information : https://msdn.microsoft.com/en-us/magazine/dd942839.aspx

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Cheat Sheet To JAVA Latest Technology

%d bloggers like this: