How to Use Java Code Wrapped in a Service Interface

Incorporating Java and Java EE Code in a BPEL Process 13-7

6. Click Return.

In addition, ensure that the JARs are loaded by the SOA composite application. To add custom classes: 1. Copy the classes to the classes directory. 2. Restart Oracle WebLogic Server. To add custom JARs: 1. Copy the JAR files to this directory or its subdirectory. 2. Run ant. 3. Restart Oracle WebLogic Server.

13.4 Using Java Embedding in a BPEL Process in Oracle JDeveloper

In Oracle JDeveloper, you can add the bpelx:exec activity and copy the code snippet into a dialog.

13.4.1 How To Use Java Embedding in a BPEL Process in Oracle JDeveloper

To use Java embedding in a BPEL process in Oracle JDeveloper: 1. From the Component Palette, expand Oracle Extensions. 2. Drag the Java Embedding activity into the designer. 3. Double-click the Java Embedding activity to display the Java Embedding dialog. 4. In the Name field, enter a name. 5. In the Code Snippet field, enter or cut and paste the Java code. Figure 13–1 provides details. Note: For custom classes, you must include any JAR files required for embedded Java code in the BpelcClasspath property in the System MBean Browser of Oracle Enterprise Manager Fusion Middleware Control. See Section 13.3.1, How to Add Custom Classes and JAR Files for instructions. The JAR files are then added to the class path of the BPEL loader. If multiple JAR files are included, they must be separated by a colon : on UNIX and a semicolon ; on Windows. 13-8 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite Figure 13–1 bpel:exec Code Example

13.4.2 What You May Need to Know About Using thread.sleep in a Java Embedding Activity

If you create and deploy a BPEL process that uses thread.sleep in a Java Embedding activity, the executing thread is blocked and the transaction associated with that thread is prevented from committing. This causes BPEL instances to appear only after the wait is over, which is the expected behavior. Instead, use a wait activity, which releases the resource upon entering the activity and enables the ongoing transaction to commit and the BPEL instance data to hydrate into the data store.

13.5 Embedding Service Data Objects with bpelx:exec

You can embed service data object SDO code in the .bpel file with the bpelx:exec tag. In the syntax provided in Example 13–6 , mytest.apps.SDOHelper is a Java class that modifies SDOs. Example 13–6 Embedding SDO Objects with the bpelx:exec tag bpelx:exec bpelx:exec name=ModifyInternalSDO version=1.5 language=java [CDATA[try{ Object o = getVariableDataVarSDO; Object out = getVariableDataExtSDO; Note: As an alternative to writing Java code in the Java Embedding activity, you can place your Java code in a JAR file, put it in the class path, and call your methods from within the Java Embedding activity.