SOAP v/s REST:
SOAP->( Simple Object Access Protocol)
- A protocol designed before REST protocol.
- Idea behind designing SOAP was to ensure that programs built on different plateforms/ programming lang could able to exchange data in easy manner.
REST->( Representation state transfer)
- designed specially for working with components such as: media,Components, file etc.
- Any web service that is defined on a particular principle of REST called as RESTfull web Service.
- Restful services would use the normal HTML verbs of GET, POST, PUT & DELETE for working with the required component.
When to use REST & when to use SOAP ?
REST Services should be use in the following:
- Limited resources & bandwidth: Since SOAP msgs are heavier in content and consume greater bandwidth, So in limited bandwidth REST is better option than SOAP.
- Statelessness: if there is no need to maintain state of information while request originated from one resource to other, in this case REST should be used.
- Caching: if there is a need to cache a lot of requests then REST is perfect solution.
- Ease of coding
SOAP services should be use in the following:
- Asynchronous processing and subsequent invocation: if you need a guaranteed level of reliability & security then SOAP is used.
- A formal means of communication: if the server and client have agreement on exchange format.
- A Stateful operation
Happy Learning 🙂
Praveen Maurya work in e-commerce domain having knowledge of Plugin development in Magento 1.x/2.x, Drupal, Woo-Commerce, PrestaShop, Opencart and other e-commerce solution. When he is not engrossed with anything related to these, he loves to explore new things.