Java Code Embedding
Java code embedding is another method for integrating Java code and resources into BPEL processes. It allows us to embed Java code snippets directly into BPEL process code. This provides the opportunity to use Java for certain aspects where BPEL does not provide an appropriate activity. It also provides a way to use Java code to call other Java resources (EJBs, JCA, JMS, etc.). Compared to WSIF, Java code embedding has several drawbacks. The most important is that it requires proprietary extensions to BPEL code, thus limiting the portability of BPEL processes.
To embed Java code snippets into BPEL, Oracle provides a custom BPEL activity called <exec>
, defined in the http://schemas.oracle.com/bpel/extension namespace. This namespace is usually declared with the bpelx
prefix, so we write the activity as <bpelx:exec>
.
The BPEL server will execute the Java code embedded in the <exec>
activity within its JTA (Java Transaction API) transaction context. If the...