
Please note: This post originally appeared on Extol.com (EXTOL has been acquired by Cleo).
In this blog, the age old discussion of “Which is Better: SOAP or REST?” will be discussed, and challenges associated with your decision. We’re going to list advantages and tradeoffs of each, but first let’s start with a little background information to this architecture style.
What is a REST Web Service?
The acronym REST stands for REpresentational State Transfer, meaning each unique URL represents some object. The architecture was developed by Roy Fielding, one of the authors of the Hypertext Transfer Protocol (HTTP). A REST API uses HTTP and supports the HTTP GET, POST, PUT or DELETE methods.
What is a SOAP Web Service?
Defined as Simple Object Access Protocol, it is a specification for exchanging structured information using Extensible Markup Language (XML) and usually HTTP protocol for transmission. SOAP also uses Web Services Description Language (WSDL) documents that provide a model for describing web services. Basically, it defines what the SOAP request (client-side) and response (server-side) should look like.
The Debate
For years, people have been debating which of these public APIs is better and why. We’re going to list some pros and cons for each but the answer to the million dollar question of which is better is: it DEPENDS.
A SOAP Web service consists of an envelope, header and body all structured in XML format. A WSDL document describes the service and contains schemas for the request and response which makes consuming a SOAP web service fairly easy. Listed below is an example of the basic structure of a SOAP message.
<env:Envelope xmlns:env=”http://www.w3.org/2003/05/soap-envelope”>
<env:Header>
<!– Header information here –>
</env:Header>
<env:Body>
<!– Body or “Payload” here, a Fault if error happened –>
</env:Body>
</env:Envelope>
A REST Web service does not need to contain any XML, and can be as simple as a URL. An example of getting a real time price for a stock quote would be to specify an HTTP GET to http://example.com/quote?symbol=XXX
As you can see, there are variations between both Web service types, so we comprised a partial list of pros and cons for each Web service to point out the differences.

The point we’re trying to make is that there is no right or wrong answer to the question of which is better. If you’re a consumer then it’s likely the provider has already made the decision for you. When time is a limiting factor REST is usually the better choice but when creating a service with multiple, non-CRUD methods your best option is SOAP because each method is explicitly defined in the WSDL. REST is a better choice for simple, CRUD-oriented services, because of the way REST repurposes HTTP methods (GET, POST, PUT, and DELETE). It is also popular because it’s lightweight and has a smaller learning curve.
SOAP, on the other hand, has standards for security, addressing, etc. Your requirements will determine which type of web service you will implement unless already decided by the WS Provider. Companies such as eBay and Amazon have Web services for both REST and SOAP, and as more companies become service oriented and expose more functionality, they’ll need to support both types since there is no right answer.