XForms and OpenWFE - Part 1

The following information is taken from a document that was created for an x-port.net client, eVision for their XRAI application, which is an online doctoral fellowship award system.

The information was intended as an introduction to OpenWFE for new developers to the project and gives a high level overview of the main OpenWFE components and how they are used within the XRAI project.

OpenWFE

For the workflow engine component of the Xrai system we have chosen to use OpenWFE, an open source multi-platform project, written in Java. OpenWFE can run as a complete standalone application or with some of its components running in a servlet container, which is the configuration in the Xrai environment, using Apache Tomcat.

Components

There are five main components that make up OpenWFE, the Engine, Worklist, APRE, Droflo and Webclient. For the Xrai environment the Droflo and Webclient components are deployed in Tomcat as .war files and, in the x-port Windows based development environment, the Engine, Worklist and APRE are configured to run as services using the Java Service Wrapper. The eVision development environment is running Linux.

Definitions of what each of the components do in the workflow engine are available in the OpenWFE docs and the general architecture section of OpenWFE is available
here.

Workflows

In the Xrai environment we use Droflo via the browser to design the workflow that users will follow and the Webclient webapp to test the developed flow. Note that it is not necessary to use the Droflo application to create the workflow, you can directly create an XML file by hand if you prefer.

Please take a look at the workflow definition syntax.

Once we are happy with the flow definition we then develop an XForm that interacts with the flow via the OpenWFE REST interface.

To make a developed workflow available to an XForm, we make it available to be accessed via HTTP. To do this we use another Tomcat webapp, 'workdefs', that serves up the workflow definition files.

Users (participants)

To interact with a workflow we have to have users. Users are stored in an XML file by default in OpenWFE but can be configured to be stored in a relational database instead, which is the case in the Xrai setup (we use MySQL). This enables us to create users dynamically using a web service called from our XForm.

In the Xrai system we've created roles that users are assigned to, applicant and referee. When a user is created they are either assigned the applicant or referee role which affects the information the created user is allowed to see and actions they are able to perform in/on the workflow (constraints are defined in the workflow definition itself). There are many configurations of users/roles and stores that can be used in OpenWFE. Read more about them in the online documentation.

Stores

The OpenWFE has one or more stores that contain workitems for users. Stores can configured a number of ways, from a store per user to a single store for all users depending on the strategies configured for them. In the Xrai system we only have one store for all users so that when a new user is created we don't have to create a store also. Again, check the online documentation.

XForm/OpenWFE Interaction

Once the workflow has been defined and is available via HTTP we are then able to write the XForm to use the workflow over the web. The OpenWFE engine has available a REST interface for this reason. Have a look at the documentation for the REST interface.

In the XForm we use a series of GET and POST XForm submissions, combined with xforms-submit-done/xforms-submit-error events to call the REST functions that process our workflow.

Links