Chapter 4. Tutorial

The best way to get acquainted with BPEL is to see it in action. For this reason, we included some examples that will help you get started quickly. At this point, you should have the jBPM BPEL enterprise application running inside JBoss. If you do not, please read the Getting started chapter first. This chapter will guide you through the example setup procedure. The subsequent chapters contain the actual examples.

4.1. Getting the Java Web Services Development Pack

jBPM BPEL relies on the Web Services for J2EE (WSEE) model for exposing a BPEL process as a web service. As of jBPM BPEL 1.1.GA, all server artifacts required for a WSEE deployment can be automatically generated from the BPEL process and its related WSDL definitions.

The automatic generation process involves an external WSDL-to-Java mapping generator. Unfortunately, such a tool is not standardized in WSEE. jBPM BPEL comes with support for the following tools. Support for other tools may become available in the future if the community has interest in them.

  • JBoss AS 4.0.4 and later versions ship with a mapping generator by the name of wstools. If you are deploying there, no further action is required.

    Be aware that wstools has a number of known limitations. If you encounter a problem while generating artifacts from your valid WSDL and XML Schema documents, try using wscompile (see below).

  • Sun provides a mapping generator called wscompile as part of its Java Web Services Development Pack (JWSDP). Please refer to the JWSDP site for installation instructions.

4.2. Getting the Eclipse BPEL designer

The Eclipse community has begun a BPEL project. The goal of this project is "to add comprehensive support to Eclipse for the definition, authoring, editing, deploying, testing and debugging of WS-BPEL 2.0 processes".

The JBoss jBPM team has been in touch with the committers of this project. Expect tighter integration between the Eclipse Designer and jBPM BPEL shortly after key pieces of functionality such as Runtime Framework and Debug become available.

No need to wait, tough. You can get started with the Eclipse BPEL designer and jBPM BPEL today! The provided examples have been ported to BPEL 2 using version 0.3.0 of the designer. You can load them, experiment a bit and then create your own processes. When you are ready to deploy, an Ant task and the deployment page in the web console are at your disposal.

4.3. Defining the environment

The resources related to each sample process reside in a separate directory under examples. Each directory contains an Ant script to assist in carrying out process deployment tasks. Note that the individual scripts import generic build files located in the common directory. If you organize your resources in the same way as the examples, you can take advantage of the templates in your own project.

The generic build file needs to be aware of your particular environment. Back in the Application packaging section, you specified the directory where you installed JBoss AS in the build.properties file, located in the config directory. If you chose to use the wscompile tool, edit build.properties again to set the JWSDP install location.

# jwsdp.home is used for generating web service artifacts
# wscompile is an alternative to wstools provided by jboss 4.0.4 and later
jwsdp.home=${software.installation.dir}/jwsdp-1.6

4.4. Creating the database schema

Before you deploy process definitions, the jBPM schema must already exist in the database. The build file from the examples directory provides a target just for this purpose.

ant create.schema

The target above does not actually access the database. It merely contacts a servlet deployed as part of the jBPM BPEL enterprise application. That servlet is the actual agent in charge of executing the DDL statements.

Hibernate emits a few log messages to the server console as it progresses. The next screen corresponds to a successful creation.

19:18:38,890 INFO  [SchemaExport] Running hbm2ddl schema export
19:18:38,890 INFO  [SchemaExport] exporting generated schema to database
19:18:38,890 INFO  [DatasourceConnectionProvider] Using datasource: java:/DefaultDS
19:18:39,046 INFO  [SchemaExport] schema export complete
19:18:39,062 INFO  [[/jbpm-bpel]] administrationServlet: created schema

Alternatively, the database connection page in the web console offers the option to create the schema as well.

Database connection page

Figure 4.1. Database connection page