views:

194

answers:

4

Well as the title suggest, what is this Restful Web Service thing in Java, What are its benefits over SOAP Web Services, why the hell someone implemented again some other technology? What is the reason to use Restful one instead of SOAP one?

For example I will give a service which will be accessible for many clients from high level languages C#, Java to low-level like C.

+1  A: 

I suggest you to read RESTful Web Services, there you're going to see many explanations and examples that are very good to learn ;)

C isn't a low-level language!

Nathan Campos
What is C then?
whoi
It's a high-level.
Nathan Campos
+1  A: 

I've got an SUV, why would anyone bother to invent a coupe? A Tractor?

REST is an alterntative to WS. There are several strains of thought here:

  • There's a deep theoretical underpinning as to why the REST approach is significant, for that follow the reference given by Nathan, Wikipedia and so on.
  • Some folks find the full WS-* stack overcomplex and pretty hard work, they find REST a lot simpler
  • Web 2.0 javascript apps find it very easy to use REST/JSON, it really fits very nicely.

Starting today in a greenfield site I'd be very torn about which approach to take.

djna
A: 

A key component of a RESTful architecture is that the server is stateless. This means that no client context is stored by the server (a shopping basket, for example). Each client must maintain its own state, and each request it submits to the server must contain all the necessary information.

SOAP, on the other hand, is a standard for exchanging information. It is designed around XML to provide a platform and language independent approach to improve interoperability.

REST and SOAP are therefore quite separate concepts. A RESTful architecture quite often employs SOAP RPC as its messaging mechanism. Alternatively it may use the HTTP methods (GET, PUT etc).

Web Services using SOAP/HTTP can be, and often are, exactly as stateless as RESTful services.
djna
A: 

http://www.infoq.com/articles/webber-rest-workflow is a very good example of an HTTP-based RESTful interface.

It's a good example of how to take full advantage of the HTTP protocol, instead of just using it to tunnel method calls as SOAP does.