SOAP and REST are two main approaches to web services
construction. Both approaches solve similar problems – the question of
distributed systems construction. But they do it in different ways.
SOAP/WS-* approach is used in web services built on the
basis of ASP.NET or WCF. There are also other platforms to build SOAP-services.
It is supposed that SOAP-service is focused on operations performance. To
access to a web service a SOAP-request is generated on the client side and is
sent a server. On a server side this request is processed, the operation is
preformed and the SOAP-answer comes back. In a SOAP-request there is a method
name that should be started on a service side and its parameters. A
SOAP-response contains a result of these techniques and, if necessary, output
parameters.
It is supposed, that SOAP-messages are data in XML format.
However, some platforms propose an alternative way to encode SOAP-messages. For
example, Windows Communication Foundation does in a binary format.
REST approach is greatly different. It is focused on getting
data from a web service and their modification, unlike SOAP that is focused on
operations. This is the reason of REST-services limitation to work via
HTTP/HTTPS that makes it possible to address data modeling address to access a
web service. In this case there is no need to build a SOAP-request to access a
service, it is necessary to call a defined URI.
Both of these approaches exist together without impeding
each other now. They are intended for not the same tasks. The difference
between REST and SOAP is evident and it is very important to understand a
purpose of each of these approaches and use them according to a designated one.
SOAP approach is what you need when any operation should be performed on a
service side. For example, to withdraw money from your bank account or do an
order in online stores. However, if a web service work is just getting data
access from a service and their modification, it is better to use REST
approach. For example, it can be a web-service that allows us to get
information about goods in an Internet shop.