EclipseCon 2009 demo : Buying a book on Amazon with JWT / Scarbo

Description

This demonstration's goal is to model and execute a process that buys a book on Amazon using webservices.

It shows in detail how a process with calls to webservices can be modeled from Java Workflow Tooling, using some Scarbo extensions, and then can be exported into an executable process on Scarbo runtime.

It is originally a JWT demonstration using Scarbo runtime and extensions that has been presented at EclipseCon 2009.

Screenshots, Wink, Videos...

Here's the demo screencast.

Credits

This demonstration has been designed by Florian Lautenbacher and Christian Saad of the University of Augsburg, with thorough technical support from Mickaƫl Istria of Open Wide.

Important

The description of this demonstration is not based on a release of Scarbo, but on development versions, that do not have any versioning/releasing governance.

Then this informations may become obsolete as soon as Scarbo will have its first release and/or EclipseCon 2009 and OW2 Conf at Solutions Linux.

If you try to run this demonstration and encounter any problem, do not hesitate to ask the community and developers.

Installation

Start the servers

  • Web Services
This demonstration uses a set of custom webservices. They can be found here. Simply unzip this archive somewhere on your achine and start them by typing java -Djaxws -jar demo2009.server-0.0.1-SNAPSHOT.jar. 3 web services are deployed on port 8081.
  • Bonita console
    • Set the JAVA_OPTS environment variable to contain -Djaxws
    • then start the Bonita console normally, with bin/bpm.sh start if you use Linux, and bin/bpm.bat start for Windows

Model the process

Model the process normally, using the WebService application when you want an automated task to call a web service. Specify the web service endpoint into the Interface property, and the operation to call into the Operation property. If everything is OK, the modeler will introspect the WSDL and, when available, automatically set I/O for this operation.

Then, the rules to keep in mind are

  • Names (for actions, applications or data or anything else) must not contain space
  • Each data must have a parameter with the exact same name as the data itself
  • DataBindings on actions must be set
  • Data must have their DataType set to an XPDL datatype
  • Roles are currently not resolved by transformation, so that you have to set the role to the name of the assignee in Bonita (for example john or james)
If you model your process conforming to these rules, then you should not have any problem.

A sample workflow file can be found here.

Transform it into a Bonita archive

Simply use, from Eclipse, "File > Export… > Java Workflow Tooling > Export into another metamodel", then select transformation to Bonita4 BAR, and set output file. You'll get your Bonita Archive ready to deploy.

Please note that since a BAR file is actually a ZIP, you can unzip it and see it contents if you are curious. It should contain a XPDL file and a .properties file, with extension of model. See Architecture page for more details.

Limitations/TODO:

  • Data scopes are not resolved, hence all variables are global

Run

Your generated BAR file is ready to go! Just import this process into Bonita through console, using an admin user, and manipulate as a normal process.

The BuyBook process needs "john" to set a request (some keywords to look for on Amazon), a valid (==conforming to RFC) emailAddress, and a valid (==16digits) VISA card number. At the end of the process, you should have, if email and credit card are valid, a purchaseURL. Then you can follow the link to pay your order on Amazon.

Troubleshooting

If you get an error, here are a set of things to check:

  • Ensure that JAVA_HOME, java and javac are all pointing to the same VM.
  • Ensure that lib folder does not contain asm-1.5., cglib- (except cglib_nodep), jaxb--2.0
  • Ensure that your servers are started with the jaxws property set. For Tomcat, ensure that the JAVA_OPTS system property is set to contain -Djaxws when calling ./bpm.sh start