views:

446

answers:

7

Duplicate: This is a duplicate of "What are the best uses of REST services?" and many others. Please close it.

In web development:

Should i learn RESTful services very well and make all my future projects using it? Is it faster than SOAP services? When to use which?

There is certain cases i should use one of them and others no?

+2  A: 

In my experience, SOAP adds some overhead that you can avoid by making a RESTful service. That being said, in your decision, you should consider your audience. If you are expecting to have a large variety of outside-world consumers of your service, I would recommend SOAP, because there are a lot of tools that automatically generate a programmatic interface to it.

Some web services, like PayPal, offer multiple alternatives, so you could also consider choosing both.

Jacob
+1: Start with REST. Add SOAP when a customer demands it.
S.Lott
And try to avoid SOAP even then.
Hank Gay
The general aversion to SOAP I reckon is due to the poor implementations of it. When it's done properly, it's a lot easier, and a more robust mechanism than REST.
skaffman
@skaffman, true, but there are so many poor implementations...
Ionuț G. Stan
@skaffman @Ionut Not true, or even meaningful.
Wahnfrieden
+2  A: 

REST should be faster than SOAP in most cases since it is more light weight, less overhead.

But there are some situations in which you need the functionality that is in that overhead.

Unless you want to standardise on one (this reduces the number of technologies in your solution, and therefore the complexity), the rule of thumb would be use REST when you can and SOAP where you must.

Shiraz Bhaiji
sounds like how I approach my exercise regime :-)
Phil Nash
For example, SOAP envelopes can contain headers and faults which is often helpful meta-data
matt eisenberg
A: 

Absent a clear requirement to the contrary, you should always prefer REST to SOAP. There are (rare) times when SOAP provides you with what you need (and those times will get more rare as REST improves, such as having a WADL standard), but in the general case, SOAP is just a whole lot of headache to get you where REST is already standing and waiting.

Yishai
REST will not have a WADL or similar standard, since it is just an architecture.
Wahnfrieden
WADL already exists, so it seems kind of late to argue that REST won't have a WADL standard. It just remains to be seen how popular it will be. The fact of the matter is a standardized way of knowing what parameters you can send to a REST service and what you get back is useful. Until that exists in REST, SOAP and WSDLs will fill that gap. Of course, many REST services won't fit with a WADL or employ one, but that isn't the same thing.
Yishai
Standardization makes NO sense for REST, since REST is an architectural style, not a specific technology or protocol. The fact that there will never be a standard for REST is BY DESIGN. Fielding himself says this. I think you misunderstand REST and architecture in general.
Wahnfrieden
I think that rather misses the point. It is nice to try to argue some pure definition, but in fact REST has a de facto meaning and de facto standards. Perhaps you would prefer to say that in cases where you need a defined protocol, SOAP is the better choice, but to my thinking REST is developing de facto protocols, even if Fielding didn't imagine it.
Yishai
Yishai, you'll have to elaborate, since I can't see a reason to agree with that. There are varying implementations of REST, there is not one specific valid type of implementation.
Wahnfrieden
A: 

To directly answer your question, I'd say yes. REST is usually regarded as the lighter alternative. Also, at the current stage, REST is still consider/practiced by many to be more of a "direction/guideline" then a full protocol.

There's an interesting article depicting their differences in an interesting dialogue.

Personally, I'd say REST should be pretty much better than SOAP in all cases a normal person would choose. On the other hand, designing a true REST architecture requires a lot of planning and considerations. Most attempts fail at that and become STREST (mentioned in the above article), which is like mixing SOAP and REST and losing some of the benefits REST provides.

kizzx2
So, *yes*, REST is generally faster than SOAP?
pbreitenbach
Yes lol. I can't believe I mistyped that one magic word (which I bolded)
kizzx2
+2  A: 

One factor is that RPC communications are often not cached as part of the HTTP stack because the caching middleware shouldn't need to understand the contents of the request. So, RESTful systems can take better advantage of caching.

Wahnfrieden
+1: Leveraging the standard HTTP caching infrastructure is a huge performance win for REST services, probably orders of magnitude more important than smaller payload size.
Jim Ferrans
Of course, this is only a win in terms of retrieving resources. A POST, PUT, DELETE, etc. will not be cached. Also, there's a dependency on how fresh the data need to be. Caching will be of little benefit if the data need to be accurate, literally, up to the minute.
John Saunders
A: 

Also found a nice article talking about SOAP and RESTful

http://www.techbubbles.com/webservices/rest-and-soap/

Amr ElGarhy
A: 

REST will almost always be faster since there's less processing and smaller envelopes.

pbreitenbach
Not accurate. REST works well for large-grained resources too.
Wahnfrieden