SOAP or Simple Object Access Protocol and REST which stands for Representational State Transfer are two different web service communication protocols which are extensively used. SOAP has been used for developing web service interfaces for a very long time, but recently REST has taken over SOAP in terms of popularity as the dominant web service communication protocol. According to statistics REST makes up for about 70% of public APIs.
SOAP protocol was originally developed by Microsoft and is majorly used in legacy software systems whereas REST is relatively new and came into spotlight big time with the advent of internet and HTTP.
REST compliant web service allows the system which is requesting the data to access, update, create or delete textual representation of web resources through certain predefined stateless operations. SOAP protocol exposes certain models of application logic is services mainly using XML data format.
In a RESTful web service when requests are made to a URI, it gives out a response in different data formats, commonly HTML, XML, JSON etc. REST protocol is stateless and follows standard operations which allows it to be fast and reliable, at the same time developers can make changes to it without breaking down the entire system.
REST offers greater optionality when it comes to data formats where as SOAP majorly focusses upon XML. REST works really well with JSON format as it is simple to read, store and parse.
REST is usually the preferred choice of protocol unless and until there is a very specific use case to go for SOAP protocol. SOAP has a built in retry mechanism to compensate for failure where as in case of REST, it has to be written. Usually when the transactions require ACID compliance then, SOAP is preferred mode of communication.
SOAP supports WS-security, WS-Addressing, WS-coordination and host of other web services standards which are not there in REST. Most of the new APIs are usually written in REST and JSON and it has become the industry standard because all modern web browsers support it natively.