Wednesday, July 15, 2009

Calling custom Java classes from BPEL

You can call some of your custom java classes in the form of extension functions. An extension function is invoked using a name such as prefix:localname(). The prefix must be the prefix associated with a namespace declaration that is in scope.

Extension functions must be implemented in Java. You bind external Java classes by encoding the class name part in the namespace URI. The URI for the namespace identifies the class where the external function will be found. The namespace URI must be "java:" followed by the fully-qualified class name; for example xmlns:date="java:java.util.Date"). The class must be on the classpath, or more specifically accessible from the current classloader.

Example:
First, create your Java class.



Second, pack your new java class into a jar file and put it accessible from the current classloader.
If ODE is deployed as a webapp, you can copy your XPath function jar in the webapp /lib directory
If ODE is deployed inside a JBI container, you can deploy your XPath function jar as a shared library. Finally call your Java class from your BPEL code.



Download the example from here.

2 comments:

Nazar Annagurban said...

This is indeed very useful. However, the last photo of the usage is not visible and not click-able. And I couldn't download the example, the link asks for password. Could you please make it accessible?

Unknown said...

Pls allows to download the example in public. I already looking for this type of example.

Thanks