DEFINE:
- REST stands for REpresentational State Transfer
- Architectural style - HTTP is the protocol that is used
- like SOAP over HTTP - REST over HTTP
- Fundamentals
- everything is a resource
- every resource is identified by an url
- only 4 operations - POST, GET, PUT, DELETE (like CRUD)
- Stateless - request / response should contain the context
- Representations doen by XML / JSON
COMPARE:
- Restful Webservice more popular to SOAP Webservice due to its simplicity - Unless u have a definitive reason to use SOAP, use REST
- SOAP vs REST
- REST operates CURD operation on the data -
getUser(User);
- SOAP has operations which have application business logic -
switchCategory(User, OldCategory, NewCategory)
- REST - Advantages
- multiple formats - XML, JSON
- JSON is easy and faster to parse
- better support for browser clients
- reads can be cached - better for performance and scalability
- SOAP - Advantages
- WS Security and not just SSL (See: SSL Limitations)
- WS Atomic Transactions - ACID property
- WS Reliable Messaging - with automatic retry facility
- SOAP is useful in scenarios where I want to make use of the above features. for eg: Iphone app interacting with bank, where I want to make sure it is complete. Retrying might be catastrophic
- In all other cases we can/should use REST.
Reference:
No comments:
Post a Comment