Thursday, September 10, 2009

GWT and Mule Playing Together

Mule is a leading open source solution for organizations to integrate and harmonize disparate systems within their enterprise. It also provides a fast track to SOA enable many of the functions within the organization and bring down barriers to application development and integration.

GWT (Google Web Toolkit) is a popular and leading framework for building AJAX web applications. There are a number of ways for GWT applications to communicate, the standard one is through its built-in RPC mechanism but there is no easy way for your GWT applications to talk with Mule endpoints directly.

SOAFaces is a lightweight framework that ties GWT and Mule together and makes it possible for GWT apps to access the Mule API and services directly from the AJAX client. This is done through the SOAFaces UniversalClient java interface which is very similar to the MuleClient interface found in the Mule APIs. The UniversalClient allows for messages to be invoked on Mule endpoints (SOA endpoints) and objects/data to be passed and returned directly from the GWT client code. All this is done without the need to use the GWT RPC mechanism. Simply use the UniversalClient interface in much the same way you would traditionally use the MuleClient interface in the Mule framework.

SOAFaces provides three sub APIs to develop with:*
This is the main package that includes the UniversalClient interface and facilitates the communication and marshaling (JSON or GWT/Java serializable objects) between GWT client and Mule/SOA back end services. This package can be used independently with any custom GWT application and in any j2ee app server. Mule endpoints can be invoked and messages will be routed to a MuleClient proxy on the j2ee back end. This is all transparent to the GWT/SOAFaces developer. Mule requests from GWT are proxied through the webserver and out to the Mule services bus, with all marshaling handled by SOAFaces.

This package in SOAFaces makes it easy to build modular GUI applications (called Weblets) in GWT that have convenient access to SOA services like Mule (using UniversalClient interface). This package also provides a simple and optional API to persist the state of GWT POJO objects, so building modular web apps is easier and with less hassle using SOAFaces!

This package in SOAFaces allows building back end server components called Tasklets. Tasklets can be used in jobs and workflows to execute back end batch type processing. Tasklets can be chained together to form more complex workflows and allowing message passing between the Tasklets which provides for rich functionality to be supported. Refer to JobServer for an example of a job scheduling engine that implements the Tasket API and for running and managing jobs.

The SOAFaces framework brings together these APIs for building Mule and GWT powered applications making accessing Mule a quick hop away from your AJAX apps.

For more information please refer to the SOAFaces website.