What Problems Are Better Solved By SOAP Over REST?

Posted on DotNetBlocks See other posts from DotNetBlocks
Published on Tue, 22 Nov 2011 01:18:00 -0500 Indexed on 2011/11/22 18:13 UTC
Read the original article Hit count: 400

In the battle for web service supremacy SOAP and REST have been battling for years. In my personal opinion this debate should have never existed. Yes, both forms can be used to create an interactive web service, but each form of a service was developed independent of each other to solve two different yet similar problems. Based my research and experience I would have to say that REST should be the preferred web service methodology and SOAP should only be used in specific situations. Note, I did not say that I was against SOAP, and in fact I actually like to use SOAP when it is needed.

Criteria for using SOAP:

  • Does the service need a guaranteed level of reliability and security?
  • Did the provider and consumer of the service agreed on a standardized data exchange format?
  • Does the service need data context and state management?

If you answer yes to any of these questions, then you may want to consider SOAP as the format for the web service.

Another way to look at the relationship between REST and SOAP is to look at the medical field.  For most things a general doctor or you family health care provider can acceptably treat most conditions from the case of a common cold to a broken bone. A general doctor more aligns with REST in my opinion because for most service requirements REST fulfills a projects needs, but what happens if you need more of an advanced examination, you would go to a specialist. A specialist would already have experience dealing with specific issues that you are experiencing giving them specific context to how best treat you going forward. SOAP acts more like a specialist doctor giving that they understand the context of an issue and can treat it based on the state of other patients they have already treated.

An example of where I would use SOAP over REST in real life would be a single sign-on application. I n these cases I need to check validate a username and password for authentication and authorization of a web page request. This service would need to maintain state while it authenticated a user and while it validated access to a web page on a subsequent request. This service must process every request for access and not allow caching to ensure that every request is processed and the appropriate users are allowed to view selected web pages.

References:

© DotNetBlocks or respective owner

Related posts about Development Methodologies