Java calls can be embedded in any xpath expressions used in business process, examples are < from >, < to > and < condition > elements. Java calls also can be embedded in xslt style sheets invoked from doXslTransform
Java methods are either written on demand, or existing libraries or JDK
library functions. They can be either static or member functions and parameters passed to
these functions & return value types needs to be one of the types
supported by xpath. They are String, Number, Boolean and Node.
Number maps to all sub classes of java.lang.Number and is converted to java.lang.Double.
Node maps to org.w3c.dom.Node.
Example transformations/utilities that can be implemented could be
Let us explore syntax details using an example. Please check out working example from cvs -d :pserver:guest@cvs.dev.java.net:/cvs co open-jbi-components/driver-tests/bpelse/POJOCalls
Query for person's address where city is Monrovia
"AddressSearchOperationIn" business process variable, it's part points to a "person" document. Java function (AddressSearchByCity.addressSearchByCity) matches addresses by given city name and returns them. package name - address class name - AddressSearchByCity method name - addressSearchByCity
Define a prefix with fully qualified class name, xmlns:addSearch="java://address.AddressSearchByCity". Invocation would be prefix:function name, for this example it is addSearch:addressSearchByCity
complete syntax
<copy xmlns:addSearch="java://address.AddressSearchByCity">
<from>addSearch:addressSearchByCity($AddressSearchOperationIn.part1, "Monrovia")</from>
<to>$AddressSearchOperationOut.part1</to>
</copy>
This example demonstrates usage of Java method calls in combination with other xpath expressions. Xpath expression is converting tmpDouble to string and concatenating with value of $inputVar.inputType/ns2:paramA.
<copy xmlns:javastring="java://java.lang.String">
<from>concat($inputVar.inputType/ns2:paramA, ' + ',javastring:valueOf($tmpDouble))</from>
<to>$outputVar.resultType/ns2:paramA</to>
</copy>
If the jar's are big and not specific to the bpel project and are generic utilities that need to be accessed by multiple service units then its best to add it to the application server class-path. The image below shows how that can be achieved using the application server admin console (http://{host-name}:4848), where the ojdbc14.jar is added to the application server system class-path.
![]() |
![]() |