Going from SOAP to REST Web Services

August 17, 2007
coldfusion

I received a questions in my email today from blog reader, Rob Rawlins:

A client of mine wants me to change the SOAP web service I publish into a REST service, and I dont even know where to begin.

After googling around for a while you're one of the only people I could find mentioning ColdFusion and REST in the same sentence :-D

Any ideas on where I should be beginning with this?

It's a good question, and I'm not surprised that there isn't a whole lot on the internet about ColdFusion and REST, since it is so easy to create SOAP web services in CFML. So I thought this would make a good blog entry...

To start it is essential to understand what the differences between the REST architecture and the SOAP architecture are. I've written a blog entry called REST vs SOAP Web Services which should give you a primer. For more details I would check out Roger Costello's Building Web Services the REST Way.

My next step would be to take a look at some actual REST web services that are popular, and well designed. If you are a visual learner like me this is an easy way to understand how they work.

  • Flickr API - Flickr has API's using REST, SOAP, and XML-RPC so it's a good one to see the differences.
  • Yahoo API's - Many of the Yahoo API's use REST.
  • 37Signals API's - Basecamp, Backpack, Highrise all use the REST approach.

Once you have translated all the SOAP method requests into an REST request requests implementing the service should not be that difficult. Just invoke your SOAP component methods locally, and format the response in XML.

Before I had a chance to post this entry Rob has already implemented his REST service, and said:

Coincidentally I've already worked on my own solution which seems to be working nicely. I simply created a 'wrapper' for my current SOAP webservice, that uses <cfinvoke> to invoke the webservice with the POST data sent by the REST call, and then reformat the XML data ready to be parsed, I hadn't realized how simple it was, its actualy of benefit too me as it allows a more OO development approach to the service, and also makes for a much lower overhead and bandwidth.

The new service is super snappy, I'm very pleased.


Related Entries

8 people found this page useful, what do you think?

Comments

A good introduction tutorial to REST can be found here: http://learn-rest.blogspot.com/ It contains code samples in lots of languages, however, it seems to focus more on client-side than server side.
Hi,
I'd like to know if we can invoke SOAP service in a RESTful implementation.
If you know the solution, please send me the solution. Howto is most preferable.
Thanks a lot.
Sorry this is a very old post, but it came up high on Google. I am planning a CF-based RESTful service and am a bit confused on URL construction. Roger Costello says not to use verbs ie a.com/item?id=1234, but instead use this: a.com/item/1234. Obviously these URLs a bit trickier to implement (on IIS), so I went through Yahoo's API and they don't respect this condition. They do things through query params ie: http://search.yahooapis.com/WebSearchService/V1/webSearch?appid=YahooDemo&query=finances&format=pdf

Would I be doing RESTful a disservice by using query parameters to control my argument/value pairs?
Hi, the open source tool Membrane Router can expose SOAP based Web Service as REST resource without programming. You can even transform a GET request into a SOAP POST. And it can return JSON. See:

http://www.membrane-soa.org/rest2soap-gateway.htm

Post a Comment




  



Spell Checker by Foundeo

Recent Entries



foundeo


did you hack my cf?