Showing posts with label rest. Show all posts
Showing posts with label rest. Show all posts

Wednesday, June 18, 2014

SOAP vs REST

Constraints

SOAP(simple object access protocol)

RESTful (Representational State Transfer)

Protocol
XML based protocol defines rules of message type/format on top running on any protocol (SMTP, HTTP, FTP, TCP/IP)
Describes architectural principles which runs on HTTP/HTTPS and have no additional message layer/formats
Data Type
Standard format of XML
No standard set of format and can be any type i.e., XML, JSON, HTML, Plain Text
State
State is maintained
Stateless and preferred for single operations. (GET, CREATE, READ, DELETE, Update)
Adding web services in existing application
Existing web application needs to be modified and need more effort to add web services into the application
Existing web application need not any modification and additional very less effort needed to add web services.
Lightweight
Heavyweight
Lightweight
Speed
Slow because of XML formats
Fast because of no additional message layers
Security
More secured as data going as XML with secured headers, encryption available.
Less secured data transfer.
Caching
Not available
Available for HTTP GET resources
Implementation and Client creation
Little bit complex
Implementation is easy and client creation also easy if we know the input/output data format.
Access Type
WSDL defines messages, bindings, operations and locations of web services.
Simple Unique URI for each resource and no further complex definitions
When to use?
1.   More reliable and secured as SOAP has more standard set of rules
2.   Both server and client has mutual contract between them
3.   If want to have state-full transactions
4.   Supports any transport protocol SMTP, TCP/IP, JMS and HTTP
5.   Best choice for combined and distributed and dependent services
6.   Complex and development needs learning
1.   If low bandwidth with high performance
2.   If you want to have CRUD kind of applications or expose resources and not fit business operations
3.   If you like to cache some static resources
4.   Supports only HTTP/HTTPs
5.   Best choice for direct point to point services like sharing IT assets or CRUD operations
6.   Easy to learn and implement