Project Zero, a RESTful new beginning for IBM

IBM has entered the world of RESTful Web services and scripting languages like Groovy and PHP with Project Zero. William Brodgen digs into the details of how it works.

Yes, Project Zero really does deserve the "New Beginning" label. With this project, IBM is making a completely

fresh start on Web services using the REST paradigm. The name comes from the slogan "Zero complexity. Zero overhead. Zero obstacles." Particularly striking is the emphasis on direct support of the popular scripting languages PHP, Groovy and JavaScript for rapid development. Generally speaking, Project Zero takes the "convention over configuration" and model-view-controller (MVC) pattern approach favored by Ruby on Rails. Standards such as WSDL and the WS-* group are ignored.

IBM considers Project Zero to be an "incubator" for exploring ideas without ties to previous architectures. However, this is not exactly open-source development, the site declares:

This community is an experiment in a new way to build commercial software, an approach we are currently calling Community-Driven Commercial Development.

There will shortly be commercial products based on Project Zero, IBM WebSphere sMash and IBM WebSphere sMash Developer Edition. These developer platforms provide visual tools for creating applications with a minimum of code writing. The name sMash is obviously intended to suggest ease of creating "mashup" applications, which draw resources from a variety of services. It is not clear to me whether or not deployment of Project Zero applications outside the WebSphere world will ever be possible.

Current state of development

Presently Project Zero is releasing new versions every month or so. At this time it is at "Milestone 7" roughly similar to the JAX-RS (Jersey) project which is also at version "early access 0.7" with roughly monthly releases. Note that JAX-RS is an evolving standard with Jersey as the reference implementation while Project Zero is evolving independently of any standard except HTTP

Project Zero architecture
The central problem of a RESTful Web service is interpreting the
URI and headers of a request routing it to the correct process so the desired representation is returned. In Project Zero architecture, processing an HTTP request can be thought of as firing a sequence of events. Each step accomplishes some phase of logical processing and may lead to the next step or an error. Advanced programmers can create their own event handling code. The default event processing sequence goes like this:

  • requestBegin - Builds a data structure representing the request.
  • secure - Requests which do not pass security checks cause return of a HTTP error code and control passes to the log step.
  • GET, PUT, POST, DELETE - The HTTP method and URI are used to locate code to generate the response.
  • log - Records according to the log configuration settings, always runs.
  • requestEnd - Clean up of resources used, always runs.

Note that only the method and URI are used to locate the code to generate a response. This is done through configuration files and a doXXX method naming convention in scripts. In other words, in step 3, if the request method is GET, the application will look for doGET methods in the scripts for a particular URI. Selection of the output rendering method to create the desired return type ( HTML, XML, JSON, etc.) is up to the programmer. Project Zero provides a library of Groovy and PHP "renderers" which can handle many of the typical output formats. For example, the Groovy template facility lets you create mostly static HTML page templates which get a few request specific values filled in during rendering.

Configuring Zero server
Project Zero makes extensive use of the Apache Software Foundation Ant make tool and the related Ivy dependency manager to coordinate assembly of all the parts of an application. Ant and Ivy files are in XML format. JavaScript Object Notation (JSON) script files are used extensively for application configuration and initialization of data structures where other toolkits might use XML or properties files.

The Zero Resource Model for Database Driven Applications
Following the MVC paradigm used in so many Web service architectures, Project Zero has the Zero Resource Model (ZRM) which uses JSON to define and declare databases (models) using conventions that simplify coding applications. Given a database defined with ZRM conventions, you can quickly create Ajax style dynamic HTML pages which use the Dojo toolkit, has been integrated into the Project Zero distribution.

Using the Eclipse plugin for Zero
Following the instructions on the Project Zero site, I started Eclipse (version 3.2.2 required) and set the search for new features path to the Project Zero update location. After agreeing to the license, Eclipse smoothly added Groovy support and examples plugins for the current Project Zero version (M7). Although the Project Zero site gives some information on what Java request handlers should look like, the current plugin emphasizes Groovy and does not contain a Java example. Given the ease with which Groovy scripts can call Java objects and libraries, using Groovy to interface with existing Java objects should be easy.

Contrast with JAX-RS
Project Zero will obviously be competing with Sun's JAX-RS API as used in the Jersey project for developer mindshare, so lets compare the two. The most obvious difference is language support. Although written partly in Java, Project Zero emphasizes the scripting languages Groovy, PHP and JavaScript. In contrast, JAX-RS is completely centered on Java and depends extensively on Java annotations, although JSON output is supported, application code will be in Java.

A developer's right to commercial use of Project Zero is tightly controlled in IBM's "community-driven commercial development" license and is currently tied to the WebSphere world. In contrast, the JAX-RS specification is freely available and has at least four independent implementations including the open-source Jersey project. Some JAX-RS implementations permit very compact RESTful services.


This was first published in April 2008

Dig deeper on Service-oriented architecture (SOA) implementations

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchSoftwareQuality

SearchCloudApplications

SearchAWS

TheServerSide

SearchWinDevelopment

Close