REST Web-services

If people talk of “Web-Services”, they often mean SOAP as maintained by the W3C. But SOAP isn’t everything. In fact SOAP was a basically a RPC (Remote Procedure Call) protocoll over HTTP (therefore the name Simple Object Access Protocoll). Since W3C took over SOAP (from Microsoft and later IBM) it has been extended into more general directions.

With REST (Representational State Transfer) similar applications can be written. REST itself is only an architectural style (defining how you should design your application). REST was initiated by the IETF as the basic model for the modern Web. HTTP 1.1 was designed using REST as tool for discovering unproper features etc… .

What is the essence of REST?

REST sees the Web as a collection of resources connected to a common network. Each resource has a set of associated methods (PUT, GET, POST, DELETE) to operate on them. SOAP on the other hand has services with definable methods (like getCustomerRecord, setCPUHeat etc…).

Since REST heavily depends (or defines) on existing standards existing software can easily be used with it. For example firewall administrators can block writing methods (DELETE, PUT, POST) on some resources, or internet caches are able to store resources requested by GET. SOAP uses POST (non-cacheable) to transfer the data between the client and the server. Using SOAP a firewall administrator has no chance to control access to his resources – he can allow or disallow SOAP (meaning HTTP). SOAP applications have to manager their own security.

The REST/SOAP debate is often compared to pre-SQL eras. Think of a database providing “getCustomerRecord” and “setCPUHeat” commands instead of general SELECT and UPDATE statements on resources like “Customer” and “CPU”. The same applies to REST – here we have general methods, with SOAP we have specialized interfaces.

Why SOAP if REST is so good?

SOAP is a product (at least you can make products from the SOAP specification) – REST is “only” an architectural style. Guess with which one companies can make money? REST of course has it’s drawbacks too, for example you cannot buy libraries to ease some task… . REST isn’t widely known/accepted and few companies provide explicit support. Amazon calls it’s XML over HTTP a REST interface, and flickr have REST interfaces too (usually XML over HTTP). The biggest drawback of REST is the lack of a description language – SOAP has a very powerful one with WSDL.

Want a more in-depth treatment? REST article in PDF

The Church says that the Earth is flat, but I know that it is round. For I have seen the shadow on the moon and I have more faith in the Shadow than in the Church.
— Ferdinand Magellan (possibly misattributed)