Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SOAP vs. REST: Pragmatic case studies?

Tags:

web-services

I'm not satisfied with the answers given by the SOAP vs REST questions notably here: Performance of SOAP vs. XML-RPC or REST

because it's just general philosophical answers and not pragmatic answers with some study cases.

Nobody can give precise cases of when soap would be more suitable than rest, especially as for performance point of view ?

Update:I think REST is winning the war.

like image 522
user310291 Avatar asked May 01 '10 22:05

user310291


People also ask

When should I use SOAP over REST?

A general rule of thumb when you're deciding between SOAP and REST for building your API: if you want standardization and enhanced security, use SOAP. If you want flexibility and efficiency, use REST.

What is difference between SOAP and REST?

REST is a set of guidelines that offers flexible implementation, whereas SOAP is a protocol with specific requirements like XML messaging. REST APIs are lightweight, making them ideal for newer contexts like the Internet of Things (IoT), mobile application development, and serverless computing.

Does REST have better performance than SOAP?

REST allows a greater variety of data formats, whereas SOAP only allows XML. Coupled with JSON (which typically works better with data and offers faster parsing), REST is generally considered easier to work with. Thanks to JSON, REST offers better support for browser clients.

What are the advantages of SOAP over REST?

Another advantage of SOAP is that it offers built-in retry logic to compensate for failed communications. REST, on the other hand, doesn't have a built-in messaging system. If a communication fails, the client has to deal with it by retrying. There's also no standard set of rules for REST.


1 Answers

Performance is not the deciding factor.

First I should say, asking a SOAP-vs-REST question is a little cockeyed, because SOAP is a XML envelope format, and REST is an architecture. So I will make a little assumption and suppose that you are really considering SOAP-vs-POX or SOAP-vs-JSON or SOAP-vs-some other data formatting approach.

The deciding factor should be this:
Do you now need, or will you need in the future, the SOAP envelope?

The SOAP Envelope allows things like framework-provided encryption, digsig, routing, and authorization checks, among other things. You can of course, do those things with REST (or more accurately, with plain-old-XML, or JSON, etc) but you have to do more work yourself, to make that happen.

If Performance - whatever you construe it to mean - really is your #1 criterion, then you should probably abandon SOAP and POX and move to protobufs or something else optimized for performance. These can be faster to serialize and faster to transmit.


If you think this answer is "too philosophical" and you really want hard figures, well, then I suppose you'll need to conduct some tests. The actual perf will vary greatly on the toolkits you choose, the shape of the messages, and the extra data services (like encryption and so on) that you use. But in the end, perf won't be, or shouldn't be, decisive either way.

If your SOAP toolkit is 20% easier to use. debug, and maintain as your POX toolkit, then you should use SOAP, regardless of the performance. People (coders, architects, testers) are much more expensive than CPUs and networks these days. You can always buy another 2 cpus, or a bigger network, if necessary, and if your design is correct. But you can't buy 20% less time developing, at any cost, if your framework is hard to use, or if it drives away your people. Unless you are running a geo-scale network, you will do better to optimize for the people, instead of for the network.

like image 121
Cheeso Avatar answered Nov 12 '22 16:11

Cheeso