Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Web Services and the fly likes Convenient features of REST against SOAP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Convenient features of REST against SOAP" Watch "Convenient features of REST against SOAP" New topic

Convenient features of REST against SOAP

chets patel
Ranch Hand

Joined: Apr 27, 2010
Posts: 77

I know there is big debate going over the net about REST against SOAP. I would like to ask few questions on the top of that.

I am using JAX-WS (SOAP) for quiet few years and It took me no time to learn and it becomes difficult to fit REST on top of SOAP because I could not find a single reason that will convince me that REST is better than SOAP.

People say that REST is easier than SOAP. But according to me, I don't see any learning curve difference between the two.
Suppose I add 1 field in say 10 domain object which is not null, how will I notify my webservice clients if I am using REST. In SOAP generally we publish WSDL. But there is no WSDL here.
How to publish URIs to the client. Let me explain this point in detail.
Say I want to expose cancel order service in REST. My URI is{orderId}. How will my client know that they have to use DELETE and not GET as I have only cancelOrder method and not getOrder method. Also how to publish these different URIs. In SOAP, we publish WSDL. I agree that client need to be recompiled. But publishing the changes to the client is easier in the SOAP. 4. Also people say REST is architecture style. What does this mean?

I am neither against REST nor favouring SOAP. But I am not getting convinced to the extent at which people favour REST. So I think I must be missing some good points of SOAP.

I hope this is not a duplicate question. I tried to search about these specific questions and didn't find answer.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
In SOAP generally we publish WSDL. But there is no WSDL here.

True. Some JAX-RS implementations (like Jersey) support WADL, which serves the same purpose (although some people think it is not necessary). But generally there is no formalized documentation of the API, mostly I'd guess because REST WS take few parameters to begin with, and those are easily described. REST is mostly used where you don't have 10 domain objects.

You're correct that in general REST is less feature rich than SOAP - no WSDL, no WS-Security, no UDDI. If you need those then SOAP is for you. I'd count REST's simpleness as one of the chief benefits, though. All that is needed is an HTTP client, which is built into just about all languages/platforms where I might want to consume a WS, particularly mobile apps and web browsers. Same for JSON, which is often used as data format with REST. The overwhelming majority of WS used by mobile apps and web apps is based on REST, not SOAP (which quickly becomes a hassle in these environments).

REST is architecture style. What does this mean?

That question goes beyond what can usefully be explained in a forum post. Start with some of the articles linked in the WebServicesFaq.
I agree. Here's the link:
subject: Convenient features of REST against SOAP
It's not a secret anymore!