REST vs SOAP Web Services
I am seeing a lot of new web services are implemented using a REST style architecture these days rather than a SOAP one. Lets step back a second and explain what REST is.
What is a REST Web Service
The acronym REST stands for Representational State Transfer, this basically means that each unique URL is a representation of some object. You can get the contents of that object using an HTTP GET, to delete it, you then might use a POST, PUT, or DELETE to modify the object (in practice most of the services use a POST for this).
Who's using REST?
All of Yahoo's web services use REST, including Flickr, del.icio.us API uses it, pubsub, bloglines, technorati, and both eBay, and Amazon have web services for both REST and SOAP.
Who's using SOAP?
Google seams to be consistent in implementing their web services to use SOAP, with the exception of Blogger, which uses XML-RPC. You will find SOAP web services in lots of enterprise software as well.
REST vs SOAP
As you may have noticed the companies I mentioned that are using REST api's haven't been around for very long, and their apis came out this year mostly. So REST is definitely the trendy way to create a web service, if creating web services could ever be trendy (lets face it you use soap to wash, and you rest when your tired). The main advantages of REST web services are:
- Lightweight - not a lot of extra xml markup
- Human Readable Results
- Easy to build - no toolkits required
SOAP also has some advantages:
- Easy to consume - sometimes
- Rigid - type checking, adheres to a contract
- Development tools
For consuming web services, its sometimes a toss up between which is easier. For instance Google's AdWords web service is really hard to consume (in CF anyways), it uses SOAP headers, and a number of other things that make it kind of difficult. On the converse, Amazon's REST web service can sometimes be tricky to parse because it can be highly nested, and the result schema can vary quite a bit based on what you search for.
Which ever architecture you choose make sure its easy for developers to access it, and well documented.
- PostalMethods - Web Service for Snail Mail - July 27, 2008
- Going from SOAP to REST Web Services - August 17, 2007
- Web Distrbuted Data Exchange - April 13, 2005
- ColdFusion SOAP Web Services and onRequestStart - November 19, 2009
- Web Services Problems with ColdFusion 8 on a Mac - August 16, 2007
REST does have a description language options - HTML Form, WSDL 2.0, or WADL.
REST on the other hand fits in places where standards is less important is or in homogeneous environment??
Someone here asked for a sample REST web service. I would go here: http://3.ly/restxdemo. It demonstrates RESTx - an open source project for the creation of RESTful web services, home page: http://restx.mulesoft.org. RESTx introduces a whole new concept in which RESTful web services can be created and consumed.
The reason REST has gotten so popular is that it has an ALTERNATIVE to what SOAP has to offer when it comes to making web services quick and easy.
You can think of the 2 methods like this:
-SOAP being a letter made of an envelope(the container), address field(who is to receive the letter) and the body (the contents inside the letter). This means you cant see what is in a SOAP message until opened.
-RESTful being a post-it where you write the contents on it and slam it up in the left upper corner of the billboard and tell people about it. Now you can't have one post-it going on top of another, meaning that RESTful web services needs a unique URI(link).
This was just a bit about the subject. The main conclusion is that you should think of REST as an alternative to SOAP, being more easy, faster and less complicated than SOAP is to create. At least that is how it is at the moment. As far as i know, Oracle and Microsoft are trying to come up with a solution...
subject. Would you prefer I link to you using your
site address: http://www.petefreitag.com/item/431.cfm or blog title: REST vs SOAP
Web Services. Be sure to let me know at your earliest convenience.
we're in the middle of building a tool to download and import patents from uspto.
contact info_at_createtank_dot_com to discuss
1) SOAP is a true protocol. REST is more of an architectural philosophy.
2) SOAP has built in support for ACID transactions. SOAP also has a DTC. That's why PayPal uses it. With REST you have to roll your own.
- Securing Legacy CFML - dev.Objective() 2016 Slides
- My CFSummit 2015 Slide Decks
- Adding Chrome Custom Search for CFDocs
- Disable Flash Remoting on ColdFusion Servers
- HackMyCF Adds SSL/TLS Scanner
- IncompatibleClassChangeError after ColdFusion 11 Update 5
- Scope Injection in CFML
- Upload Files Directly to Amazon S3 using ColdFusion