Oracle® Application Server Integration InterConnect Adapter for JCA Installation and User's Guide
10g Release 2 (10.1.2) B19182-01 |
|
Previous |
Next |
This chapter describes the design-time and run-time concepts for the JCA adapter. It contains the following topics:
The design time for JCA adapter consists of following three steps:
Generating a WSDL file
Modifying the generated WSDL file
Importing the generated WSDL in iStudio by using the WSDL browser to create the common view and application view
These design-time steps are explained by using a scenario in the following sections.
This section describes how to design and execute the following integration scenario
The publishing JCA adapter polls two database tables Departments
and Employees
for new record inserts. The DeptID
column of the Employees
table references the DeptID
column of the Departments
table.
When you insert a new record in any of these tables, the publishing JCA adapter publishes the message to the InterConnect Hub. This message contains the data that was inserted in the table.
The subscribing JCA adapter polls the InterConnect hub queue for messages and receives the new message.
The subscribing JCA adapter inserts the data contained in the message into the NewEmployees
or NewDepartments
tables.
Pre-Requisites
This example assumes that you are familiar with basic BPEL constructs, such as activities and partner links, and JDeveloper environment for creating a BPEL process.
You need following tables for this scenario:
DEPARTMENTS
Use the following code to create the table:
CREATE TABLE DEPARTMENTS ( DEPTNO NUMBER(2) CONSTRAINT PK_DEPT PRIMARY KEY, DNAME VARCHAR2(14), LOC VARCHAR2(13) );
NewDEPARTMENTS
Use the following code to create the table:
CREATE TABLE NewDEPARTMENTS ( DEPTNO NUMBER(2) CONSTRAINT PK_NewDEPT PRIMARY KEY, DNAME VARCHAR2(14), LOC VARCHAR2(13) ) ;
EMPLOYEES
Use the following code to create the table:
CREATE TABLE EMPLOYEES ( EMPNO NUMBER(4) CONSTRAINT PK_EMP PRIMARY KEY, ENAME VARCHAR2(10), JOB VARCHAR2(9), MGR NUMBER(4), HIREDATE DATE, SAL NUMBER(7,2), COMM NUMBER(7,2), DEPTNO NUMBER(2) CONSTRAINT FK_DEPTNO REFERENCES DEPARTMENTS );
NewEMPLOYEES
Use the following code to create the table:
CREATE TABLE NewEMPLOYEES ( EMPNO NUMBER(4) CONSTRAINT PK_NewEMP PRIMARY KEY, ENAME VARCHAR2(10), JOB VARCHAR2(9), MGR NUMBER(4), HIREDATE DATE, SAL NUMBER(7,2), COMM NUMBER(7,2), DEPTNO NUMBER(2) CONSTRAINT FK_NewDEPTNO REFERENCES NewDEPARTMENTS );
JCA adapter uses the WSDL file to perform the WSIF invocation. You can generate a WSDL file in many ways. This section explains how to generate WSDL files by using the Oracle JDeveloper.
Generating the JCAPublish.wsdl File
Follow these steps to generate the JCAPublish.wsdl
file in JDeveloper:
From the File menu, select New. The New Gallery dialog box is displayed.
Select Workspaces from Categories and then Workspace from Items.
Click OK. The Create Workspace dialog box is displayed.
Enter MyWorkspace
as Workspace Name.
Deselect Add a Empty New Project and click OK.
Right-click MyWorkspace and select New Project. The New Gallery dialog box is displayed.
Select Project from Categories and select BPEL Process Project from Items.
Click OK. The BPEL Process Project dialog box is displayed.
Enter Publisher
as the BPEL Process Name.
Select Empty BPEL Process from Templates.
Figure 3-1 BPEL Process Project dialog box
Click OK.
Drag a Partner Link activity from the components palette. The Create Partner Link dialog box is displayed.
Enter PublishProcess
in the Name field.
Click the Define Adapter Service icon. The Adapter Configuration Wizard Welcome window is displayed.
Click Next. The Adapter Type window is displayed
Select Database adapter.
Click Next. The Service Name window is displayed.
Enter a JCAPublish
in the Service Name field.
Select a database connection from Connection. If no connection exists, you can also create a new connection. To create a new connection, click New and use the Create Database Connection wizard to create a new connection.
Figure 3-4 Specifying the Service Connection
Click Next. The Operation Type window is displayed.
Select Poll for New or Changed Records in a Table.
Click Next. The Select Table window is displayed.
Click Import Tables. The Import tables window is displayed.
Select Employees and Departments table from Available and click the right arrow.
Click OK.
Select Departments table as the root database table.
Click Next. The Relationships window is displayed.
Click Next. The Object Model window is displayed.
Click Finish.
Click OK in the Create Partner Link dialog box.
Copy the following files from the project directory to the publishing adapter directory:
toplink_mappings.xml
JCAPublish.wsdl
Departments_table.xsd
Generated JCAPublish.wsdl file
After performing these steps, following JCAPublish.wsdl
file is generated:
<?xml version="1.0" encoding="UTF-8"?> <definitions name="JCAPublish" targetNamespace="http://xmlns.oracle.com/pcbpel/adapter/db/JCAPublish/" xmlns:tns="http://xmlns.oracle.com/pcbpel/adapter/db/JCAPublish/" xmlns:plt="http://schemas.xmlsoap.org/ws/2003/05/partner-link/" xmlns:jca="http://xmlns.oracle.com/pcbpel/wsdl/jca/" xmlns:pc="http://xmlns.oracle.com/pcbpel/" xmlns:top="http://xmlns.oracle.com/pcbpel/adapter/db/top/Publisher" xmlns="http://schemas.xmlsoap.org/wsdl/"> <types> <schema xmlns="http://www.w3.org/2001/XMLSchema"> <import namespace="http://xmlns.oracle.com/pcbpel/adapter/db/top/Publisher" schemaLocation="Departments_table.xsd"/> </schema> </types> <message name="DepartmentsCollection_msg"> <part name="DepartmentsCollection" element="top:DepartmentsCollection"/> </message> <portType name="JCAPublish_ptt"> <operation name="receive"> <input message="tns:DepartmentsCollection_msg"/> </operation> </portType> <binding name="JCAPublish_binding" type="tns:JCAPublish_ptt"> <pc:inbound_binding/> <operation name="receive"> <jca:operation ActivationSpec="oracle.tip.adapter.db.DBActivationSpec" DescriptorName="Publisher.Departments" QueryName="JCAPublish" PollingStrategyName="DeletePollingStrategy" MaxRaiseSize="1" MaxTransactionSize="unlimited" PollingInterval="5" MappingsMetaDataURL="toplink_mappings.xml" <input/> </operation> </binding> <!-- Your runtime connection is declared in J2EE_HOME/application-deployments/default/DbAdapter/oc4j-ra.xml These 'mcf' properties here are from your design time connection and save you from having to edit that file and restart the application server if eis/DB/DBConnection is missing. These 'mcf' properties are safe to remove. --> <service name="JCAPublish"> <port name="JCAPublish_pt" binding="tns:JCAPublish_binding"> <jca:address location="eis/DB/DBConnection" UIConnectionName="DBConnection" ManagedConnectionFactory="oracle.tip.adapter.db.DBManagedConnectionFactory" mcf.DriverClassName="oracle.jdbc.driver.OracleDriver" mcf.PlatformClassName="oracle.toplink.internal.databaseaccess. DatabasePlatform mcf.ConnectionString="jdbc:oracle:thin:@localhost:1521:ORCL" mcf.ConnectionString="jdbc:oracle:thin:@localhost:1521:ORCL" mcf.UserName="scott" mcf.Password="3E20F8982C53F4ABA825E30206EC8ADE" /> </port> </service> <plt:partnerLinkType name="JCAPublish_plt" > <plt:role name="JCAPublish_role" > <plt:portType name="tns:JCAPublish_ptt" /> </plt:role> </plt:partnerLinkType> </definitions>
Generating the JCASubscribe.wsdl File
Follow these steps to generate another WSDL with name JCASubscribe
:
Click Applications and then right-click MyWorkspace.
Select New Project.
Select Project from Categories and select BPEL Process Project from Items.
Select Empty BPEL Process from Templetes.
Click OK. The BPEL Process Project dialog box is displayed.
Enter Subscriber
as the BPEL Process Name.
Click OK.
Drag a Partner Link activity from the components palette. The Create Partner Link dialog box is displayed.
Enter SubscribeProcess
in the Name field.
Click the Define Adapter Service icon. The Adapter Configuration Wizard Welcome window is displayed.
Click Next. The Adapter Type dialog box is displayed.
Select Databse adapter and click Next. The Service Name dialog box is displayed.
Enter a JCASubscribe
in the Service Name field and click Next. The Connection dialog box is displayed.
Select a database connection from Connection. If no connection exists, you can also create a new connection. To create a new connection, click New and use the Create Database Connection wizard to create a new connection.
Click Next. The Operation Type dialog box is displayed.
Select Perform an Operation on a Table.
Select Insert or Update.
Deselect Delete and Select.
Click Next. The Select Table dialog box is displayed
Click Import Tables. The Import tables dialog box is displayed.
Select NewEmployees and NewDepartments table from Available and click the right arrow.
Click OK.
Select NewDepartments table as the root database table and click Next. The Relationships dialog box is displayed.
Click Next.
Click Finish.
Click OK in the Create Partner Link dialog box.
Copy the following files from the project directory to the subscribing adapter directory:
toplink_mappings.xml
JCASubscribe.wsdl
Newdepartments_table.xsd
Note: the generated files should be copied to the home directory of the adapter only. |
Generated JCASubscribe.wsdl File
After performing these steps, following JCASubscribe.wsdl
file is generated:
<?xml version="1.0" encoding="UTF-8"?> <definitions name="JCASubscribe" targetNamespace="http://xmlns.oracle.com/pcbpel/adapter/db/JCASubscribe/" xmlns:tns="http://xmlns.oracle.com/pcbpel/adapter/db/JCASubscribe/" xmlns:plt="http://schemas.xmlsoap.org/ws/2003/05/partner-link/" xmlns:jca="http://xmlns.oracle.com/pcbpel/wsdl/jca/" xmlns:pc="http://xmlns.oracle.com/pcbpel/" xmlns:top="http://xmlns.oracle.com/pcbpel/adapter/db/top/Subscriber" xmlns="http://schemas.xmlsoap.org/wsdl/"> <types> <schema xmlns="http://www.w3.org/2001/XMLSchema"> <import namespace="http://xmlns.oracle.com/pcbpel/adapter/db/top/Subscriber" schemaLocation="Newdepartments_table.xsd"/> </schema> </types> <message name="NewdepartmentsCollection_msg"> <part name="NewdepartmentsCollection" element="top:NewdepartmentsCollection"/> </message> <message name="Newdepartments_msg"> <part name="Newdepartments" element="top:Newdepartments"/> </message> <portType name="JCASubscribe_ptt"> <operation name="merge"> <input message="tns:NewdepartmentsCollection_msg"/> </operation> <operation name="insert"> <input message="tns:NewdepartmentsCollection_msg"/> </operation> <operation name="update"> <input message="tns:NewdepartmentsCollection_msg"/> </operation> <operation name="write"> <input message="tns:NewdepartmentsCollection_msg"/> </operation> <operation name="queryByExample"> <input message="tns:Newdepartments_msg"/> <output message="tns:NewdepartmentsCollection_msg"/> </operation> </portType> <binding name="JCASubscribe_binding" type="tns:JCASubscribe_ptt"> <jca:binding /> <operation name="merge"> <jca:operation InteractionSpec="oracle.tip.adapter.db.DBWriteInteractionSpec" DescriptorName="Subscriber.Newdepartments" DmlType="merge" MappingsMetaDataURL="toplink_mappings.xml" /> <input/> </operation> <operation name="insert"> <jca:operation InteractionSpec="oracle.tip.adapter.db.DBWriteInteractionSpec" DescriptorName="Subscriber.Newdepartments" DmlType="insert" MappingsMetaDataURL="toplink_mappings.xml" /> <input/> </operation> <operation name="update"> <jca:operation InteractionSpec="oracle.tip.adapter.db.DBWriteInteractionSpec" DescriptorName="Subscriber.Newdepartments" DmlType="update" MappingsMetaDataURL="toplink_mappings.xml" /> <input/> </operation> <operation name="write"> <jca:operation InteractionSpec="oracle.tip.adapter.db.DBWriteInteractionSpec" DescriptorName="Subscriber.Newdepartments" DmlType="write" MappingsMetaDataURL="toplink_mappings.xml" /> <input/> </operation> <operation name="queryByExample"> <jca:operation InteractionSpec="oracle.tip.adapter.db.DBReadInteractionSpec" DescriptorName="Subscriber.Newdepartments" IsQueryByExample="true" MappingsMetaDataURL="toplink_mappings.xml" /> <input/> </operation> </binding> <!-- Your runtime connection is declared in J2EE_HOME/application-deployments/default/DbAdapter/oc4j-ra.xml These 'mcf' properties here are from your design time connection and save you from having to edit that file and restart the application server if eis/DB/DBConnection is missing. These 'mcf' properties are safe to remove. --> <service name="JCASubscribe"> <port name="JCASubscribe_pt" binding="tns:JCASubscribe_binding"> <jca:address location="eis/DB/DBConnection" UIConnectionName="DBConnection" ManagedConnectionFactory="oracle.tip.adapter.db.DBManagedConnectionFactory" mcf.DriverClassName="oracle.jdbc.driver.OracleDriver" mcf.PlatformClassName="oracle.toplink.internal.databaseaccess.DatabasePlatform" mcf.ConnectionString="jdbc:oracle:thin:@localhost:1521:ORCL" mcf.UserName="scott" mcf.Password="3E20F8982C53F4ABA825E30206EC8ADE" /> </port> </service> <plt:partnerLinkType name="JCASubscribe_plt" > <plt:role name="JCASubscribe_role" > <plt:portType name="tns:JCASubscribe_ptt" /> </plt:role> </plt:partnerLinkType> </definitions>
In the generated WSDL files, you need to specify the abosolute parh of the toplink_mappings.xml
file in the MappingsMetaDataURL
parameter such as:
MappingsMetaDataURL="file:///C:/Oracle/midtier/integration/interconnect/adapters/myJCAAdapter/toplink_mappings.xml"/>
This section describes design-time steps to be performed in iStudio for implementing the scenario. it contains the following steps:
To create a common view:
From the File menu, select New Project. The New Project dialog box is displayed.
Enter the JCAProject
in the Project Name field.
Click OK. The Hub Information dialog box is displayed.
Enter information in the following fields:
Hub database username: The name of the hub database user.
Hub database password: The password associated with the hub database user.
Hub database url: The URL of the database in the following format:
machine name:port number:database sid
In iStudio, click JCAProject, Common View, and then click Business Object.
Right-click Business Object and select New. The Create Business Object dialog box is displayed.
Enter the JCABusObj
in the Business Object Name field.
Click OK.
In the iStudio list, click JCABusObj and then click Event.
Right-click Event and select New. The Create Event dialog box is displayed.
Enter the CVPublishEvent
in Event Name field.
Click Import, and then JCA.
Click Browse.
Navigate to the JCAPublish.wsdl
file and click Open. The Choose Operation from WSDL dialog box is displayed.
Select Receive Operation.
Click OK.
Click Save in the Create Event dialog box.
Repeat Step 9 to Step 16 to create an event CVSubscribeEvent
by using the JCASubscribe.wsdl
file.
To publish the JCA event:
In iStudio, click JCAProject, and then right-click Applications.
Select New. The Create Application dialog box is displayed.
Enter the JCAPublisher
in the Application Name field and click OK.
In iStudio, click Applications, JCAPublisher, and then Published Events.
Right-click Published Events and select New. The Publish Wizard- Select an event dialog box is displayed.
Perform the following steps:
Select JCA from the Message Type list.
Click Business Objects, JCABusObj, and then CVPublishEvent from the Select an Event list.
Click Next. The Publish Wizard- Define Application View dialog box is displayed.
Click Import and then WSDL. The Choose Operations From WSDL dialog box is displayed.
Click Browse and select JCAPublish.wsdl
.
Click Open. The Choose Operation from WSDL dialog box is displayed.
Select Receive operation.
Click Next. The Publish Wizard- Define Mapping dialog box is displayed.
Click Define Mapping. The Mapping Parameters dialog box is displayed.
Perform the following mappings:
In JCAPublisher view, select Departments[ ].
In Transformations, select ObjectCopy.
In Common View, select Departments[ ].
Click Add.
Click OK.
Click Finish.
To subscribe to the JCA event:
In iStudio, click JCAProject, and then right-click Applications.
Select New. The Create Application dialog box is displayed.
Enter the JCASubscriber
in the Application Name field and click OK.
In iStudio, click Applications, JCASubscriber, and then Subscribed Events.
Right-click Subscribed Events and select New. The Subscribe Wizard- Select an event dialog box is displayed.
Perform the following steps:
Select JCA from the Message Type list.
Click Business Objects, JCABusObj, and then CVSubscribeEvent from the Select an Event list.
Click Next. The Subscribe Wizard- Define Application View dialog box is displayed.
Click Import and then WSDL. The Choose Operations From WSDL dialog box is displayed.
Click Browse and select JCASubscribe.wsdl
.
Click OK. The Choose Operation from WSDL dialog box is displayed.
Select Insert operation.
Click Next. The Publish Wizard- Define Mapping dialog box is displayed.
Click Define Mapping. The Mapping Parameters dialog box is displayed.
Perform the following mappings:
In Common View, select Newdepartments[ ].
In Transformations, select ObjectCopy.
In JCASubscriber view, select Newdepartments[ ].
Click Add.
Click OK.
Click Next.
Click Finish.
This section describes how JCA adapter works at run time. It contains the following sections:
When JCA adapter acts as a publishing adapter, it communicates with the JCA compliant resource adapter through adapter framework. When the adapter is started, the bridge performs endpoint activation to register a callback with the adapter framework. Once this callback is registered, the bridge is ready to start processing the messages it receives from the adapter framework through the registered callback. The resource adpater, in turn, is getting the messages from the Enterprise Information System (EIS).
When the JCA adapter acts as a subscribing adapter, the communication between the bridge and the resource adapter happens through Web Services Activation Framework (WSIF). The bridge uses the WSDL file to perform the WSIF invocation. The bridge obtains the information about the WSDL file to be used from the metadata that was defined in iStudio during design time. This metadata also contains information about which port type and operation is to be used from the WSDL file. When the bridge receives the message from agent, it uses this information for WSIF invocation.
The process for starting the adapter varies based on the operating system.
To start the JCA adapter on UNIX:
Change to the directory containing the start script.
cd ORACLE_HOME/integration/interconnect/adapters/Application
Type start and press Enter.
To start the JCA adapter from Services on Windows:
Access the Services window from the Start menu. The Services window is displayed.
Select the OracleHomeOracleASInterConnectAdapter-Application
service.
Start the service based on the operating system. For example, in Windows 2000, right-click the service and select Start from the context menu.
Note: You can also start and stop the JCA adapter using the IC Manager or Enterprise Manager. Refer to Oracle Application Server Integration InterConnect User's Guide for more details. |
The process for stopping the adapter varies based on the operating system.
To stop the JCA adapter on UNIX:
Change to the directory containing the stop script.
cd ORACLE_HOME/integration/interconnect/adapters/Application
Type stop and press Enter.
To stop the JCA adapter from Services on Windows:
Access the Services window from the Start menu. The Services window is displayed.
Select the OracleHomeOracleASInterConnectAdapter-Application
service.
Stop the service based on the operating system.
You can verify the stop status of the JCA adapter by viewing the log.xml
files. These files are located in the time-stamped subdirectory of the log
directory of the JCA adapter.