How to Embed Java Code Snippets in a BPEL Process in BPEL 2.0

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

13.2.7 How to Use Java Code Wrapped in a Service Interface

Not all applications expose a service interface. You may have a scenario in which a business process must use custom Java code. For this scenario, you can: ■ Write custom Java code. ■ Create a service interface in which to embed the code. ■ Invoke the Java code as a web service over SOAP. For example, assume you create a BPEL process service component in a SOA composite application that invokes a service interface through a SOAP reference binding component. For this example, the service interface used is an Oracle Application Development Framework ADF Business Component. The high-level instructions for this scenario are as follows. To use Java code wrapped in a service interface: 1. Create an Oracle ADF Business Component service in Oracle JDeveloper. This action generates a WSDL file and XSD file for the service. 2. Create a SOA application that includes a BPEL process service component. Ensure that the BPEL process service component is exposed as a composite service. This void setIndex int i, String value String getIndex int i Six indexes can be used for a search void setCreator String creator String getCreator Who initiated this instance void setCustomKey String customKey String getCustomKey Second primary key void setMetadata String metadata String getMetadata Metadata for generating lists String getPreference String key Access preference void addAuditTrailEntryString message, Object detail Add an entry to the audit trail void addAuditTrailEntryThrowable t Access file stored in the suitcase Object getVariableDataString name throws BPELFault Access and update variables stored in the scope Object getVariableDataString name, String partOrQuery throws BPELFault Access and update variables Object getVariableDataString name, String part, String query Access and update variables void setVariableDataString name, Object value Set variable data void setVariableDataString name, String part, Object value Set variable data void setVariableDataString name, String part, String query, Object value Set variable data Table 13–1 Cont. Built in Methods for bpelx:exec Method Name Description 13-6 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite automatically connects the BPEL process to an inbound SOAP service binding component. 3. Import the Oracle ADF Business Component service WSDL into the SOA composite application. 4. Create a web service binding to the Oracle ADF Business Component service interface. 5. Design a BPEL process in which you perform the following tasks: a. Create a partner link for the Oracle ADF Business Component service portType. b. Create an assign activity. For this example, this step copies data for example, a static XML fragment into a variable that is passed to the Oracle ADF Business Component service. c. Create an invoke activity and connect to the partner link you created in Step 5a. 6. Connect wire the partner link reference to the composite reference binding component. This reference uses a web service binding to enable the Oracle ADF Business Component service to be remotely deployed. 7. Deploy the SOA application. 8. Invoke the SOA application from the Test Web Service page in Oracle Enterprise Manager Fusion Middleware Control. For more information on creating Oracle ADF Business Components, see Oracle Fusion Middleware Fusion Developers Guide for Oracle Application Development Framework. For more information on invoking a SOA composite application, see Oracle Fusion Middleware Administrators Guide for Oracle SOA Suite and Oracle BPM Suite.

13.3 Adding Custom Classes and JAR Files

You can add custom classes and JAR files to a SOA composite application. A SOA extension library for adding extension classes and JARs to a SOA composite application is available in the ORACLE_HOMEsoamodulesoracle.soa.ext_ 11.1.1 directory. For Oracle JDeveloper, custom classes and JARs are added to the application_name projectsca-inflib directory.

13.3.1 How to Add Custom Classes and JAR Files

If the classes are used in bpelx:exec, you must also add the JARs with the BpelcClasspath property in the System MBean Browser of Oracle Enterprise Manager Fusion Middleware Control. To add JARs to BpelcClasspath: 1. From the SOA Infrastructure menu, select SOA Administration BPEL Properties .

2. At the bottom of the BPEL Service Engine Properties page, click More BPEL

Configuration Properties .

3. Click BpelcClasspath.

4. In the Value field, specify the class path.

5. Click Apply.