views:

3417

answers:

12

Attended an interesting demo on REST today, however, I couldn't think of a single reason (nor was one presented) why REST is in anyway better or simpler to use and implement than a Web Services stack.

What are some of the reasons Why anyone in the "real world" use REST instead of the Web Services?

+1  A: 

REST is basically just a way to implement web services. It is just a way to use HTTP correctly to query the web services you are trying to hit.

http://www.xfront.com/REST-Web-Services.html http://en.wikipedia.org/wiki/Representational_State_Transfer

Eric Holscher
REST has nothing to do with HTTP, and is entirely protocol-independent. It is well suited for some types of resource-centric web services though.
Wahnfrieden
+5  A: 

I'll assume that when you say "web services" you mean SOAP and the WS-* set of standards. (Otherwise, I could argue that REST services are "web services".)

The canonical argument is that REST services are a closer match to the design of the web - that is, the design of HTTP and associated infrastructure. Thus, using a REST service will be more compatible with existing web tools and techniques.

Of course, once you drill into specifics, you find out that both approaches have strengths in different scenarios. Is it those specifics that you're interested in?

Bruce
+42  A: 

Less overhead (no SOAP envelope to wrap every call in)

Less duplication (HTTP already represents operations like DELETE, PUT, GET, etc. that have to otherwise be represented in a SOAP envelope).

More standardized - HTTP operations are well understood and operate consistently. Some SOAP implementations can get finicky.

More human readable and testable (harder to test SOAP with just a browser).

Don't need to use XML (well you kind of don't have to for SOAP either but it hardly makes sense since you're already doing parsing of the envelope).

Libraries have made SOAP (kind of) easy. But you are abstracting away a lot of redundancy underneath as I have noted. yes in theory SOAP can go over other transports so as to avoid riding atop a layer doing similar things, but in reality just about all SOAP work you'll ever do is over HTTP.

Kendall Helmstetter Gelner
I'd like to add that inter-platform SOAP communication can be a PITA as well (wasn't that part of the point of SOAP?!?).
Justin Bozonier
Also working great with HTTP infrastructure - e.g. GETs are cached aggressively along with the use of last modified and etags
James Strachan
Working great with web browsers to provide a universal client to your services also helps :)
James Strachan
I would argue that SOAP is well standardized. If you mean that implementations are immature then it may be well to make that more clear. I would value some evidence for this view should you be suggesting this.I would also question whether REST is more human readable, this depends entirely on how you choose to format your content. And also remember XML is designed to be human readable, though is verbose as we all know.
Howard May
HTTP is just as standardized as SOAP, and has been around longer so implementations are really stable across the board and truly interoperable. SOAP is also inherently going to be less readable even given identical content, because of the envelope the content is wrapped in. In practice over the last few years I've found JSON over HTTP to be about the best combination, just readable enough while being even more compact.
Kendall Helmstetter Gelner
A: 

Perhaps the Wikipedia page for REST could help you here.

Ryan Bigg
Better to read the actual dissertation or other things Fielding has written about REST, like on his blog: http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven Wikipedia is not based on authoritative sources.
Wahnfrieden
+10  A: 

RESTful services are much simpler to consume than SOAP based (regular) services. The reason for this is that REST is based on normal HTTP requests which enables intent to be inferred from the type of request being made (GET = retrive, POST = write, DELTE = remove, etc...) and is completely stateless. On the other hand you could argue that it is less flexible as it does away with the concept of a message envelope that contains request context.

In my experience SOAP has been preferred for services within the enterprise and REST has been preferred for services that are exposed as public APIs.

With tools like WCF in the .NET framework it is very trivial to implement a service as REST or SOAP.

Some relevant reading:

spoon16
My understanding is that WSDL files can be used to generate classes to expose the web service methods. Surely this makes consumption of the services as easy as calling a function? Can you explain your view some more please.
Howard May
Howard May: Assuming you call functions using only primitive datatypes, this is certainly true. But in that case you can't exactly argue SOAP is easier than rest. If you have complex datatypes, WSDL processing may work fine between two machines with the same WS stacks. But you'll inevitably have issues as soon as you mix stacks. It stops being so easy once you've got to dig into WSDL by hand to debug incompatibilities.
Joseph Holsten
+2  A: 

Got to read Roy Fielding's most excellent dissertation on the topic. He makes an excellent case and was definitely WAY ahead of his time when he wrote it (2000).

Piko
+3  A: 

Steve Vinoski's blog and his latest articles are definitely worth perusing. He's a former CORBA guru, who wrote probably the best book on the subject with Michi Henning, "Advanced CORBA® Programming with C++". However, he has since seen the error of his client/server ways, and now swears by REST.

Jason Etheridge
A: 

It is super simple and slim. You could do it with browser via http verb: GET. I haven't find a browser can manually do generic http POST request easily

codemeit
Checkout Fiddler. It's not a browser but it's a great way to build HTTP POST's without code. http://fiddler2.com/fiddler2/
spoon16
I normally do it with modifying existing request with Charles. I have Fiddler too.
codemeit
+1  A: 

REST is implementation-agnostic and much more transparent, and this makes it great for public APIs, especially for big websites like Flickr, Amazon or Digg that are using their APIs as marketing tools and really want people to consume their data. They don't want to be hand-holding 1000s of novice developers who are trying to debug their scripting language of choice's buggy SOAP library.

Versus SOAP and WSDL, which are better for internal applications, where you have drop-in libraries and known clueful people on both ends. (And you maybe don't have to care about things like Internet-scale load-balancing, HTTP caching etc.) Then you get APIs that are self-documented, preserve types etc. with zero work.

joelhardi
+1  A: 

REST allows your non-mutating operations (that generally use the GET verb) to be cached. That is, cached by the client and/or cached by proxies. This can be a huge win!

David
That is simply 'using HTTP correctly,' and not REST.
Wahnfrieden
+1  A: 

The overhead isn't that important as good architecture.

REST isn't a protocol it is an architecture that encourage good scalable design. It is often chosen because too much freedom in RPC can easily lead to a poor design.

The other reason is predictable cost of RESTful protocols over HTTP because it can leverage existing technologies (mainly proxies). RPC initial cost is quite low but it tend to increase significantly with load intensification.

Piotr Czapla
+1  A: 

Here's one data point: Amazon offers its APIs in both REST and SOAP formats and 85% of the usage is REST.

REST is easier to implement, easier to understand and higher performance.

pbreitenbach
Do you have any references for your "higher performance" statement?
James McMahon