REST has advantages when:
- You have a set of resources that you want to manipulate.
- You want to support navigation between resources.
For instance, when placing an order, you receive an URI to an order confirmation resource for the order in question. Before having confirmed the order, you may even want to modify it - something that can be done with the URI of the order received when placing the order. When having confirmed the order, you receive an URI to a payment service. After having paid the order, you receive an URI to an order status resource for the order in question.
- You need scalability.
RESTful web services are tyically stateless and therefore easily scalable.
SOAP web service should also typically be stateless.
- You want to improve performance by caching web service request results at some point between the service and the consumer.
Caching on the URI of a service is very easy.
SOAP has advantages when:
- You want to publish a web service description (using WSDL).
WSDL 2 can describe RESTful web service as well. WADL is an alternative to WSDL for RESTful web services.
- You want to use security etc. that relies on the use of SOAP headers or some similar mechanism in which data is added and removed from a request.
- You want better tooling support.
- You want tested platform interoperability.
This does not mean that interoperability between platforms is easy. It just means that someone has tested it using certain web service stacks.
This is what I can think of right now. It would be interesting to hear about some other advantages/disadvantages.
Personally I feel that there is room for both SOAP and REST in my toolbox.