Use Cases for Oracle Database Adapter

Oracle JCA Adapter for Database 9-121 See Table 9–3 for the structure of the MOVIES table, which is used for many of the use cases. The readme.txt files that are included with most of the samples provide instructions.

9.8.2 Use Cases for Oracle Database Adapter - Stored Procedures

This section includes the following use cases: ■ Section 9.8.2.1, Creating and Configuring a Stored Procedure in JDeveloper BPEL Designer ■ Section 9.8.2.2, File To StoredProcedure Use Case In addition to the uses cases documented in this section, refer to the sample Oracle Database Adapter use cases available by accessing the Oracle SOA Sample Code site, and selecting the Adapters tab. Table 9–21 shows the Oracle Database Adapter stored procedure samples that are provided with Oracle BPEL PM, and Mediator. See Table 9–3 for the structure of the MOVIES table, which is used for many of the use cases. The readme.txt files that are included with most of the samples provide instructions. SelectAll Illustrates the outbound SelectAll operation of the Oracle Database Adapter. With no WHERE clause, all rows in the MOVIES table are returned as XML. SelectAllByTitle Illustrates the outbound SelectAllByTitle operation of the Oracle Database Adapter. The row in the MOVIES table with the selected title is returned as XML. Update Illustrates the outbound Update operation of the Oracle Database Adapter. An XML record is passed to the operation and the row in the database with the same primary key is updated. In JDeveloper BPEL Designer, Merge Insert or Update is provided. Table 9–21 Oracle Database Adapter Use Cases - Stored Procedures Tutorial Name Description JPublisherWrapper Illustrates a workaround for using PLSQL RECORD types. JPublisher is used to create a corresponding OBJECT type whose attributes match the fields of the RECORD, and conversion APIs that convert from RECORD to OBJECT and vice versa. JPublisher also generates a wrapper procedure or function that accepts the OBJECT and invokes the underlying method using the conversion APIs in both directions. The invoked methods must be installed in an Oracle database not Oracle Lite. RefCursors Illustrates how to use a REF CURSOR with a strongly typed or weakly typed XSD. You can use the Adapter Configuration Wizard to create a strongly typed XSD for a row set returned by an Oracle Database stored procedure or function REF CURSOR variable. For more information, see Section 9.3.3, Row Set Support Using a Strongly or Weakly Typed XSD . ResultSetConverter Illustrates a workaround for using a REF CURSOR. The solution involves the use of a Java stored procedure to convert the corresponding java.sql.ResultSet into a collection either VARRAY or NESTED TABLE of OBJECTs. Table 9–20 Cont. Oracle Database Adapter Use Cases Tutorial Name Description 9-122 Oracle Fusion Middleware Users Guide for Technology Adapters

9.8.2.1 Creating and Configuring a Stored Procedure in JDeveloper BPEL Designer

This use case describes how to integrate a stored procedure into BPEL Process Manager with JDeveloper BPEL Designer. This use case includes of the following sections: ■ Section 9.8.2.1.1, Prerequisites ■ Section 9.8.2.1.2, Creating an Application and an SOA Composite ■ Section 9.8.2.1.3, Creating the Outbound Oracle Database Adapter Service ■ Section 9.8.2.1.4, Add an Invoke Activity ■ Section 9.8.2.1.5, Change the Message Part of the Request Message ■ Section 9.8.2.1.6, Change the Message Part of the Response Message ■ Section 9.8.2.1.7, Add a Assign Activity for the Input Variable ■ Section 9.8.2.1.8, Add an Assign Activity for the Output Variable ■ Section 9.8.2.1.9, Deploying with JDeveloper ■ Section 9.8.2.1.10, Creating a DataSource in Oracle WebLogic Server Administration Console ■ Section 9.8.2.1.11, Monitoring Using the Fusion Middleware Control Console

9.8.2.1.1 Prerequisites

To perform this use case, you must define the following stored procedure in the SCOTT schema: SQL CREATE PROCEDURE hello name IN VARCHAR2, greeting OUT VARCHAR2 AS 2 BEGIN 3 greeting := Hello || name; 4 END; 5

9.8.2.1.2 Creating an Application and an SOA Composite

You need to create an JDeveloper application to contain the SOA composite. To create an application and a project for the use case, perform the following:

1. In the Application Navigator of JDeveloper, click New Application.

The Create Generic Application - Name your application page is displayed.

2. Enter MyHelloApp in the Application Name field, and click Next.

The Create Generic Application - Name your project page is displayed.

3. Enter HelloProject in the Project Name field.

4. In the Available list in the Project Technologies tab, double-click SOA to move it to

the Selected list.

5. Click Next.

The Create Generic Application - Configure SOA Settings page is displayed.

6. Select Composite With BPEL in the Composite Template box, and click Finish.

The Create BPEL Process page is displayed.

7. Enter Greet in the Name field, and then select Synchronous BPEL Process from

the Template box. Oracle JCA Adapter for Database 9-123

8. Click OK.

The Greet BPEL process in the HelloProject of MyHelloApp is displayed in the design area, as shown in Figure 9–58 . Figure 9–58 The JDeveloper - Composite.xml

9.8.2.1.3 Creating the Outbound Oracle Database Adapter Service

Perform the following steps to create an outbound Oracle Database Adapter service:

1. Drag and drop Database Adapter from the Component Palette to the External

References swim lane. The Adapter Configuration Wizard Welcome page is displayed.

2. Click Next.

The Service Name page is displayed.

3. Enter Hello in the Service Name field.

4. Click Next.

The Service Connection page is displayed. Note: Ensure that you have configured the JNDI name in the weblogic-ra.xml file before deploying this application. For more information, refer to Section 2.19.1, Creating a Data Source and Section 2.21, Recommended Setting for Data Sources Used by Oracle JCA Adapters.