Before starting with When? for using SOAP and REST. Let’s just go through basic definition of each.
SOAP:
Simple Object Access Protocol is messaging protocol specification for exchanging structure information between two application.
REST:
REpresentational State Transfer is an architectural style for providing standards between computer applications.
SOAP Services can be used in below scenarios:
- Stateful Operations are required. (eg. E-commerce website which has Shopping cart which has to maintain state across the User session and afterwards as per the need)
- Asynchronous processing and subsequent invocations.
- A formal means of communications.
REST Services can be used when Business has priorities as below:
- Limited resources
- Statelessness
- Caching
- Ease of coding