BAZOO

So much to do, so little time

Trying to squeeze sense out of chemical data

Consolidating Services

with 3 comments

Over the last few months I’ve been writing about REST services that I’ve made available. While useful they’ve been a hassle to maintain. The main reason is that many of the Python services (such as the depiction and descriptor services) are actually front-ends to SOAP services written in Java using the CDK. Thus, I have to maintain two layers of code. While deploying services using SOAP is easy (the service code is just plain Java classes and methods deployed in a Tomcat container) writing clients is not as cross-platform as SOAP afficionados make it out to be. For example, Python clients require ZSI which is rather complex for simple services, and last time I looked, does not support certain SOAP types. While SOAPpy is an easy to use option, it is no longer maintained. Furthermore, SOAP services on their own don’t necessarily provide a RESTful interface (hence the Python frontends).

Sometime back I came across a post by Rich where he mentioned Restlets. The idea is that this package makes writing RESTful services in Java easier than going through the full blown Servlet API. Indeed, it took a day or two to refactor my SOAP based services into RESTful services using Restlet. One of the nice things about the package is that while it allows you to integrate RESTful services into a Tomcat container (say for proxying purposes) you can also deploy the services via a small web server included in the package.

What is the result of all this? The short answer is that all the CDK SOAP services that I had are now packaged into a single JAR file that can be run from the command line:

1
java -jar cdkrest.jar -p 6666 -s rguha.ath.cx -l services.log

You can then access services such as http://rguha.ath.cx:6666/cdk/depict/CC=O. So there’s no need to run a Tomcat instance. Furthermore, by using Restlet, the services present a RESTful interface without requiring me to write an extra layer of Python. This also allows for easy distribution – just download the JAR file and you’re all set.

Along with refactoring code for the new Restlet based approach, I’ve been documenting the services as I go along, which is better than it being scattered over multiple blog posts. The new location for all the CDK services is http://rest.rguha.net which includes downloads and documentation. Note that this site will not actually run the services – see the site for more details.

Over time other services that are not necessarily CDK specific (such as database services) will also be migrated (in fact some of the old services are simply redirected to the new service), though certain services, such as predict, will remain as a Python service.

Written by Rajarshi Guha

February 9th, 2009 at 11:43 pm

Posted in cheminformatics,software

Tagged with , ,

3 Responses to 'Consolidating Services'

Subscribe to comments with RSS or TrackBack to 'Consolidating Services'.

  1. Impressed work!!! My first web service which in 2 seconds is done. The other question (may be absurd one) is about velocity to query. It is comparable to SOAP or RPC?

    Miguel Rojas Cherto

    10 Feb 09 at 9:27 pm

  2. Thanks! I think the performance is pretty simple – maybe even a little faster since the bandwidth consumed by the request/response is less in these REST services since they don’t need to be wrapped in SOAP envelopes. But this is not a rigorous analysis :)

    Rajarshi Guha

    11 Feb 09 at 9:58 pm

  3. [...] I have described previously, I am shifting to REST based services. Thus all the CDK based cheminformatics services are [...]

Leave a Reply