56
Oracle Service Bus (OSB) 10.3.1 – JCA Transport with DB Adapter Tutorial Oracle Corporation - Proprietary Use pursuant to HREF="http://lcsun2/release_center/engprocess/CompanyUsageInstru ctions.htm Abstract: This document describes the steps for using the JCA DB Adapter with OSB Page 1 Oracle Corporation - PROPRIETARY Use pursuant to Company Instructions

OSB - JCA DB Transport Tutorial

Embed Size (px)

DESCRIPTION

call from WebLogic OSB with JCA DataBase

Citation preview

Page 1: OSB - JCA DB Transport Tutorial

Oracle Service Bus (OSB) 10.3.1 – JCA Transport with DB Adapter Tutorial

Oracle Corporation - Proprietary

Use pursuant to HREF="http://lcsun2/release_center/engprocess/CompanyUsageInstructions.htm

Abstract:

This document describes the steps for using the JCA DB Adapter with OSB

Page 1

Oracle Corporation - PROPRIETARYUse pursuant to Company Instructions

Page 2: OSB - JCA DB Transport Tutorial

Page 2 of 48

1. Introduction........................................................................................................................ 3

2. Software Requirements......................................................................................................4

3. Pre-requisites..................................................................................................................... 5

4. High level Steps.................................................................................................................6

5. Use Case 1 – DB Business Service....................................................................................7

5.1 Step 1 – Generate WSDL for DB operations in JDeveloper.........................................7

5.2 Step 2 - Create OSB Business Service with Non-Managed Connection Mode...........19

5.3 Step 3 - Test OSB Business Service with Non-Managed connection mode...............23

5.4 WLS Console Configuration......................................................................................24

5.4.1 Configure Data Source.........................................................................................25

5.4.2 Configure DB Adapter Connection Factory...........................................................28

5.5 Step 4 – Test OSB Business Service with Managed connection mode......................32

6. Use Case 2 – DB Proxy Service.......................................................................................35

6.1 Generate WSDL for DB Poll operation in JDeveloper................................................35

6.2 Create OSB Proxy Service to poll the database........................................................41

6.2.1 Implement proxy service’s message flow..............................................................45

6.3 Deploy and test OSB Proxy Service.........................................................................47

Page 2

Oracle Corporation - PROPRIETARYUse pursuant to Company Instructions

Page 3: OSB - JCA DB Transport Tutorial

Page 3 of 48

1. IntroductionThis document provides step by step instructions for creating Oracle Service Bus (OSB) configuration to update and retrieve application data residing in a database.

In the first use case OSB Business Service, with JCA (DB) transport protocol, performs database operations such as select, insert, update, delete, invoking a stored procedure, or executing any custom SQL against the database. Hence, OSB acts as a proxy between the client that needs to perform database operations and the database. Client invokes the proxy service, which uses Route, Service Callout, or Publish to invoke the JCA business service.

In the second use case OSB Proxy Service, with JCA (DB) transport protocol, polls a database table for new or changed records. Hence, OSB acts as a proxy between the database and the backend service that intends to receive changes from the database. Proxy service polls for database table changes. Proxy service then uses Route, Service Callout, or Publish to propagate the changes to the backend service.

Page 3 10/15/01

Oracle Corporation - PROPRIETARY

Use pursuant to Company Instructions

Select Insert Update Delete Custom SQL Stored Procedure

(any) Proxy Service

JCA DB Business Service

Database

Client

OSB

Poll New or

Changed records in table

JCA DB Proxy Service

(any) Business Service

DatabaseBackendService

OSB

Page 4: OSB - JCA DB Transport Tutorial

Page 4 of 48

2. Software Requirements Oracle Database Express Edition 10g (Oracle XE)

OSB 10gR3 MP1 (10.3.1)

JDeveloper 10.1.3.x

Page 4

Oracle Corporation - PROPRIETARYUse pursuant to Company Instructions

Page 5: OSB - JCA DB Transport Tutorial

Page 5 of 48

3. Pre-requisites1. All required software installed2. Create a backup of JDEV_HOME\integration\lib\DBAdapter.jar 3. Copy OSB_HOME\eclipse\plugins\com.bea.alsb.transports.jca_<version>\DBAdapter.jar

to JDEV_HOME\integration\lib4. Create a Customer table with following columns in Oracle XE database. This document

assumes the table is created in the system schema and the database username/passwd is system/welcome1. Use the appropriate database schema and credentials as your case might be.

5. Document assumes some level of familiarity witha. Installing Oracle XE database, OSB, JDeveloperb. Creating tables using Oracle XE database.c. Using OSB proxy and business services, deployment, and testingd. Using JDeveloper to create projects, and Database Adapter instances

Page 5 10/15/01

Oracle Corporation - PROPRIETARY

Use pursuant to Company Instructions

Page 6: OSB - JCA DB Transport Tutorial

Page 6 of 48

4. High level StepsUse case 1 – DB Business Service performing database operations on behalf of the client. Specifically, the DB Business Service we implement will insert Customer records into the Customer table.

1. Generate WSDL representing database operations, and the Toplink file representing object relational mapping

2. Create Business Service in OSB to invoke database operations using a. Service Type = WSDL Web Service (using the WSDL from step 1)b. Transport Protocol = jcac. Connection Mode = Non-Managed

3. Test the business service with Connection Mode as Non-Managed (Connection Mode is configured in the JCA Transport specific properties).

4. Test the business service with Connection Mode as Managed5. Create Proxy service to expose to client. This step is only for use-case completeness, as

such, it is not described in this document.

Use case 2 – DB Proxy Service polling database changes and propagating changes to the backend service. Specifically, the DB Proxy Service we implement will poll the Customer table for new/changed Customer records and logs received records to the server console.

1. Generate WSDL representing the database (poll) operation, and the Toplink file representing object relational mapping

2. Create Proxy Service in OSB to poll the database table usinga. Service Type = WSDL Web Service (using the WSDL from step 1)b. Transport Protocol = jcac. Connection Mode = Managedd. Implement proxy service’s message flow

3. Deploy the proxy service and test

Page 6

Oracle Corporation - PROPRIETARYUse pursuant to Company Instructions

Page 7: OSB - JCA DB Transport Tutorial

Page 7 of 48

5. Use Case 1 – DB Business Service

5.1 Step 1 – Generate WSDL for DB operations in JDeveloperYou can skip this section if you are already familiar with creating the database adapter using JDeveloper.

WSDL for database operations and the top link mapping file are generated as a result of database adapter creation using the database adapter wizard in JDeveloper.

1. Create a new application in JDeveloper

a. File->New->Application

b. Name: DBContent

Page 7 10/15/01

Oracle Corporation - PROPRIETARY

Use pursuant to Company Instructions

Page 8: OSB - JCA DB Transport Tutorial

Page 8 of 48

2. Create Project

a. Name: DBProject

Page 8

Oracle Corporation - PROPRIETARYUse pursuant to Company Instructions

Page 9: OSB - JCA DB Transport Tutorial

Page 9 of 48

3. Create Database Adapter

a. Select Project ->Right Click ->New ->Business Tier ->Web Services ->Database Adapter->click OK (DB adapter wizard comes up)

Page 9 10/15/01

Oracle Corporation - PROPRIETARY

Use pursuant to Company Instructions

Page 10: OSB - JCA DB Transport Tutorial

Page 10 of 48

4. Step 1 of 2 - Service Name: DatabaseOutbound

Page 10

Oracle Corporation - PROPRIETARYUse pursuant to Company Instructions

Page 11: OSB - JCA DB Transport Tutorial

Page 11 of 48

5. Step 2 of 2 – Service Connection

a. Click New to create a new connection (or pick a connection if one already exists) – Create Database Connection wizard comes up

i. Step 1 of 4 (Type)

1. Connection Name: DbConnection2

2. Connection Type: Oracle JDBC

Page 11 10/15/01

Oracle Corporation - PROPRIETARY

Use pursuant to Company Instructions

Page 12: OSB - JCA DB Transport Tutorial

Page 12 of 48

ii. Step 2 of 4 (Authentication) – provide Database username/passwd

1. Username: system

2. Password: welcome1

Page 12

Oracle Corporation - PROPRIETARYUse pursuant to Company Instructions

Page 13: OSB - JCA DB Transport Tutorial

Page 13 of 48

iii. Step 3 of 4 (Connection) – provide Database connection information

1. Driver: thin

2. Hostname: localhost

3. JDBC Port: 1521

4. SID: XE

Page 13 10/15/01

Oracle Corporation - PROPRIETARY

Use pursuant to Company Instructions

Page 14: OSB - JCA DB Transport Tutorial

Page 14 of 48

iv. Step 4 of 4 (Testing) - Click Test connection

Page 14

Oracle Corporation - PROPRIETARYUse pursuant to Company Instructions

Page 15: OSB - JCA DB Transport Tutorial

Page 15 of 48

b. Select the connection created in a

c. JNDI Name: eis/DB/DBConnection2 (NOTE: Remember this JNDI Name as you will require it when configuring managed connection factory in WLS Console for Managed connection mode)

6. Step 3 of 3: Operation Type

a. Select Perform an Operation on a Table: leave default (all operations Insert or Update, Insert Only, Update Only, Delete, Select)

Page 15 10/15/01

Oracle Corporation - PROPRIETARY

Use pursuant to Company Instructions

Page 16: OSB - JCA DB Transport Tutorial

Page 16 of 48

7. Select Table

a. Click Import Tables - Select the appropriate table you want to work with

Page 16

Oracle Corporation - PROPRIETARYUse pursuant to Company Instructions

Page 17: OSB - JCA DB Transport Tutorial

Page 17 of 48

i. Provide appropriate Schema and Name filter and click on Query to query the tables. For e.g. use Customer% as the Name filter and select the appropriate schema.

ii. Select Customer table that was created earlier using Oracle XE) to Selected.

Page 17 10/15/01

Oracle Corporation - PROPRIETARY

Use pursuant to Company Instructions

Page 18: OSB - JCA DB Transport Tutorial

Page 18 of 48

iii. Click Next

8. Step 5 of 7: Relationships

a. Click Next

9. Step 6 of 7: Object Filtering

a. Leave defaults for Object Filtering and Click Next

10. Step 7 of 7: Define Selection Criteria

a. Check ‘Return Single Result Set’

b. Click Finish

Page 18

Oracle Corporation - PROPRIETARYUse pursuant to Company Instructions

Page 19: OSB - JCA DB Transport Tutorial

Page 19 of 48

Following files are created:

DatabaseOutbound.wsdl

DBAdapterOutboundHeader.wsdl

DatabaseOutbound_table.xsd

DatabaseOutbound_toplink_mappings.xml

NOTE: Remember the file system location for these files. You have to browse the WSDL (DatabaseOutbound.wsdl) and the top link mapping file (DatabaseOutbound_toplink_mappings.xml) when creating JCA business service in OSB.

5.2 Step 2 - Create OSB Business Service with Non-Managed Connection Mode

1. Create OSB configuration project followed by OSB Project

2. Create new business service

a. Select Project->Right click->New->Business Service

Page 19 10/15/01

Oracle Corporation - PROPRIETARY

Use pursuant to Company Instructions

Page 20: OSB - JCA DB Transport Tutorial

Page 20 of 48

3. Configure business service

a. Service Type: WSDL Web Service

b. Click Browse->Click Consume

c. Select ‘Service Resource’ as File System

d. Specify WSDL location by clicking Browse for WSDL Location and point to the wsdl file above (DatabaseOutbound.wsdl)

Page 20

Oracle Corporation - PROPRIETARYUse pursuant to Company Instructions

Page 21: OSB - JCA DB Transport Tutorial

Page 21 of 48

NOTE: If you did not replace DBAdapter.jar in JDeveloper with the DBAdapter.jar from OSB, the imported WSDL has an error. You can fix this by deleting the DatabaseOutboundSelect operation and its corresponding entry under <binding>. See step 3 of Pre-requisites.

If you run into the above error, fix the error as detailed earlier.

e. Next, on the business service select the WSDL port from the WSDL that is already imported into the workspace.

Page 21 10/15/01

Oracle Corporation - PROPRIETARY

Use pursuant to Company Instructions

Page 22: OSB - JCA DB Transport Tutorial

Page 22 of 48

f. You will notice the Transport Protocol defaults to jca and Endpoint URI points to the JNDI name specified in JDeveloper during Database Adapter configuration (See figure below).

NOTE: The JNDI name is used by the business service to look up the connection factory if the Connection mode is Managed.

Figure 1: Transport configuration

4. Configure JCA Transport specific configuration on Business Service

a. Leave all properties as default except

i. Connection Mode: Non-Managed

NOTE: Setting Connection Mode to Non-Managed helps quickly testing the business service. In this mode, connection information can be specified in two ways: One, in the WSDL. This is the case when the property ‘Always use configuration from JCA WSDL’ is checked. Two, in the JCA Transport specific properties, - Connection Factory Properties & Connection Factory Authentication Properties. In this example, we use the connection information present in the WSDL.

NOTE: In production, it is recommended to use Connection Mode as Managed.

Page 22

Oracle Corporation - PROPRIETARYUse pursuant to Company Instructions

Page 23: OSB - JCA DB Transport Tutorial

Page 23 of 48

ii. Specify Toplink file

1. You will notice an error message shown below for the Toplink file

2. Toplink File property -> Click Browse and select the top link mappings xml file (DatabaseOutbound_toplink_mappings.xml).

5. Finish – You will see the error message go away and the Non-Managed Connection Mode.

Page 23 10/15/01

Oracle Corporation - PROPRIETARY

Use pursuant to Company Instructions

Page 24: OSB - JCA DB Transport Tutorial

Page 24 of 48

Figure 2: JCA Transport Configuration

5.3 Step 3 - Test OSB Business Service with Non-Managed connection mode

1. Start Weblogic server for OSB

2. Create Server connection in Workshop

3. Right click on the business service->Run As->Run on server

4. Select Operation as Insert and specify the test data (id must be unique)

Page 24

Oracle Corporation - PROPRIETARYUse pursuant to Company Instructions

Page 25: OSB - JCA DB Transport Tutorial

Page 25 of 48

Figure 3: Test console - Request

Figure 4: Test console - Response

5. Look at the database to see the row inserted

Page 25 10/15/01

Oracle Corporation - PROPRIETARY

Use pursuant to Company Instructions

Page 26: OSB - JCA DB Transport Tutorial

Page 26 of 48

Figure 5: Row inserted in the database

Before we move to the next step to test the business service in Managed mode we must create the Data Source and the Connection Factory using WLS Console.

5.4 WLS Console ConfigurationIn the previous section, you used the Connection Mode as Non-Managed to quickly test the business service. In the Non-Managed mode, connection information in the WSDL is used.

In production, it is recommended to use the Managed Connection Mode. In the Managed mode, connection information from the connection factory defined in WLS is used. Endpoint URI of the business service is the JNDI Name of the connection factory defined in WLS.

This section provides step by step information on configuring the Data Source and the Connection Factory using WLS Console.

5.4.1 Configure Data Source

1. In WLS Console Home Page, click on JDBC -> Data Sources

Figure 5: WLS Console Home Page

2. Click New to create a new Data Source

Page 26

Oracle Corporation - PROPRIETARYUse pursuant to Company Instructions

Page 27: OSB - JCA DB Transport Tutorial

Page 27 of 48

Figure 6: JDBC Data Source Creation

3. Configure JDBC properties for the data source

a. Name: MyDB

b. JNDI Name: MyDB

c. Database Type: Oracle

d. Database Driver: Oracle’s Driver (Thin XA) versions: 9.0.1, 9.2.0, 10, 11

e. Click Next

NOTE: Remember the JNDI name for the data source. This is required when you create Connection Factory for the DB adapter.

4. Transaction Options, click Next

Page 27 10/15/01

Oracle Corporation - PROPRIETARY

Use pursuant to Company Instructions

Page 28: OSB - JCA DB Transport Tutorial

Page 28 of 48

5. Define connection properties->Click Next

6. Click test configuration

Page 28

Oracle Corporation - PROPRIETARYUse pursuant to Company Instructions

Page 29: OSB - JCA DB Transport Tutorial

Page 29 of 48

7. You MUST see connection test succeeded. Click Next

8. Select Admin server to target to (single server mode)

9. You will see the following message. You are done with configuring the Data Source.

Page 29 10/15/01

Oracle Corporation - PROPRIETARY

Use pursuant to Company Instructions

Page 30: OSB - JCA DB Transport Tutorial

Page 30 of 48

5.4.2 Configure DB Adapter Connection Factory

1. Click on Deployments on the left side of the WLS Console Home Page.

2. Click Customize this table on the right and set number of rows displayed to 100. Click Apply.

3. Scroll down to DBAdapter. Click on DBAdapter

4. Create New Connection Factory

a. Click on Configuration tab, followed by Outbound Connection Pools tab

b. Select javax.resource.cci.ConnectionFactory and Click New

5. Select javax.resource.cci.ConnectionFactory and click Next

Page 30

Oracle Corporation - PROPRIETARYUse pursuant to Company Instructions

Page 31: OSB - JCA DB Transport Tutorial

Page 31 of 48

6. Specify the JNDI Name for outbound connection instance. Next, click Finish

NOTE: The JNDI Name here MUST match the JNDI Name specified in JDeveloper. The JNDI Name specified in JDeveloper also becomes the Endpoint URI of the business service (eis/DB/DBConnection2). See Step 5c in ‘Configuring Database Adapter in JDeveloper’ and Step 3 in ‘Creating business service in OSB’.

7. You see the following messages.

NOTE: Two important steps: one, update the deployment plan with the changes and two; update the deployment with the deployment plan (See Step 9 for updating deployment with the deployment plan).

If you haven’t yet created a deployment plan for the DB Resource Adapter you will be asked to create one. In this case, you MUST create the deployment plan and then save the changes to the deployment plan. If you already created a deployment plan, it is updated with the changes.

Page 31 10/15/01

Oracle Corporation - PROPRIETARY

Use pursuant to Company Instructions

Page 32: OSB - JCA DB Transport Tutorial

Page 32 of 48

8. Update connection factory’s Data Source property

a. Select the connection you just created by clicking it (eis/DB/DBConnection2). You will see the following page

b. Click in the Property Value cell for xaDataSourceName, type the JNDI Name of the Data Source (MyDB) in the text field that appears, and then press ENTER.

NOTE: Hitting ENTER after typing the data source name is critical. Otherwise, the value will NOT be saved. Tab will NOT work either.

NOTE: The JNDI Name of the Data Source is the JNDI Name specified in Step 3 of the section on Creating a Data Source.

c. Select xaDataSourceName (by clicking on the Check box on the left) and click Save. You will again see the messages to update the deployment with the content saved in the deployment plan.

NOTE: In some cases, saving changes to the deployment plan might generate errors. Just ignore the errors!

9. Updating deployment with the deployment plan

Page 32

Oracle Corporation - PROPRIETARYUse pursuant to Company Instructions

Page 33: OSB - JCA DB Transport Tutorial

Page 33 of 48

a. Click on Deployments (on the left side) under Domain Structure

b. Select the DBAdapter by clicking on the check box on the first column for the DBAdapter row

c. Click Update.

d. You will see the following page. Leave the default (Redeploy application using following deployment plans). Click Next and then Click FINISH

NOTE: If you encounter an error by choosing the second option. Please select the first option (Update this application in place…) and then click Next.

e. You will see the following message. You are now done with configuring and updating the DBAdapter connection factory along with the Data Source

10. Logout of WLS Console

Page 33 10/15/01

Oracle Corporation - PROPRIETARY

Use pursuant to Company Instructions

Page 34: OSB - JCA DB Transport Tutorial

Page 34 of 48

5.5 Step 4 – Test OSB Business Service with Managed connection mode

1. Complete steps in Section 5.4 to configure Data Source and DB Adapter Connection Factory.

2. In Eclipse, go to the Business Service definition and set the Connection Mode JCA Transport specific property to Managed

3. Right click on the business service->Run As->Run on server

4. Select Operation as Insert and specify the test data (id must be unique)

Page 34

Oracle Corporation - PROPRIETARYUse pursuant to Company Instructions

Page 35: OSB - JCA DB Transport Tutorial

Page 35 of 48

Figure 6: Test console - Request

Figure 7: Test console - Response

5. Look at the database to see the row inserted

Figure 8: Row inserted in the database

Page 35 10/15/01

Oracle Corporation - PROPRIETARY

Use pursuant to Company Instructions

Page 36: OSB - JCA DB Transport Tutorial

Page 36 of 48

6. Use Case 2 – DB Proxy Service

6.1 Generate WSDL for DB Poll operation in JDeveloperYou can skip this section if you are already familiar with creating the database adapter for Poll operation using JDeveloper.

WSDL for database Poll operation and the top link mapping file are generated as a result of database adapter creation using the database adapter wizard in JDeveloper.

1. If JDeveloper application and project exist (from section 5.1) jump to Step 3. Otherwise, create a new application in JDeveloper

a. File->New->Application

b. Name: DBContent

2. Create Project

a. Name: DBProject

3. Create Database Adapter

a. Select Project ->Right Click ->New ->Business Tier ->Web Services ->Database Adapter->click OK (DB adapter wizard comes up)

Page 36

Oracle Corporation - PROPRIETARYUse pursuant to Company Instructions

Page 37: OSB - JCA DB Transport Tutorial

Page 37 of 48

4. Step 1 of 2 - Service Name: DatabaseInbound

5. Step 2 of 2 – Service Connection. If service connection already exists (see Section 5.1) simply select the service connection (DbConnection2) and skip this step.

a. Click New to create a new connection (or pick a connection if one already exists) – Create Database Connection wizard comes up

i. Step 1 of 4 (Type)

1. Connection Name: DbConnection2

2. Connection Type: Oracle JDBC

ii. Step 2 of 4 (Authentication) – provide Database username/passwd

1. Username: system

2. Password: welcome1

iii. Step 3 of 4 (Connection) – provide Database connection information

1. Driver: thin

Page 37 10/15/01

Oracle Corporation - PROPRIETARY

Use pursuant to Company Instructions

Page 38: OSB - JCA DB Transport Tutorial

Page 38 of 48

2. Hostname: localhost

3. JDBC Port: 1521

4. SID: XE

iv. Step 4 of 4 (Testing) - Click Test connection

b. Select the connection created in a

c. JNDI Name: eis/DB/DBConnection2 (NOTE: Remember this JNDI Name as you will require it when configuring managed connection factory in WLS Console for Managed connection mode)

6. Step 3 of 3: Operation Type

a. Select Poll for New or Changed Records in a table

Page 38

Oracle Corporation - PROPRIETARYUse pursuant to Company Instructions

Page 39: OSB - JCA DB Transport Tutorial

Page 39 of 48

7. Select Table

a. Click Import Tables - Select the appropriate table you want to work with

i. Provide appropriate Schema and Name filter and click on Query to query the tables. For e.g. use Customer% as the Name filter and select the appropriate schema.

Page 39 10/15/01

Oracle Corporation - PROPRIETARY

Use pursuant to Company Instructions

Page 40: OSB - JCA DB Transport Tutorial

Page 40 of 48

ii. Select Customer table that was created earlier using Oracle XE) to Selected.

iii. Click Next

Page 40

Oracle Corporation - PROPRIETARYUse pursuant to Company Instructions

Page 41: OSB - JCA DB Transport Tutorial

Page 41 of 48

8. Step 5 of 9: Relationships

a. Click Next

9. Step 6 of 9: Object Filtering

a. Leave defaults for Object Filtering and Click Next

10. Step 7 of 9: After Read

a. Leave default: Delete the Row(s) that were Read

b. Click Next

Page 41 10/15/01

Oracle Corporation - PROPRIETARY

Use pursuant to Company Instructions

Page 42: OSB - JCA DB Transport Tutorial

Page 42 of 48

11. Step 8 of 9: Polling Options

a. Leave Polling Frequency at the default - 5 seconds.

b. Set Database Rows per XML Document to 5

12. Step 9 of 9: Define Selection Criteria

a. Check Single Result Set. Update select query if required. I left it to be the default.

b. Click Finish

Page 42

Oracle Corporation - PROPRIETARYUse pursuant to Company Instructions

Page 43: OSB - JCA DB Transport Tutorial

Page 43 of 48

Following files are created (see under DBContent/DBProject/Resources):

DatabaseInbound.wsdl

DatabaseInbound_table.xsd

DatabaseInbound_toplink_mappings.xml

NOTE: Remember the file system location for these files. You have to browse the WSDL (DatabaseInbound.wsdl) and the top link mapping file (DatabaseInbound_toplink_mappings.xml) when creating JCA proxy service in OSB.

6.2 Create OSB Proxy Service to poll the database1. Skip this step if OSB Configuration project and OSB Project already exist (see Section

5.2). Create OSB configuration project followed by OSB Project if not present

2. Create new proxy service

a. Select Project->Right click->New->Proxy Service

Page 43 10/15/01

Oracle Corporation - PROPRIETARY

Use pursuant to Company Instructions

Page 44: OSB - JCA DB Transport Tutorial

Page 44 of 48

3. Configure proxy service

b. Service Type: WSDL Web Service

c. Click Browse->Click Consume

d. Select ‘Service Resource’ as File System

Specify WSDL location by clicking Browse for WSDL Location and point to the wsdl file above (DatabaseInbound.wsdl)

Page 44

Oracle Corporation - PROPRIETARYUse pursuant to Company Instructions

Page 45: OSB - JCA DB Transport Tutorial

Page 45 of 48

e. Next, on the business service select the WSDL port from the WSDL that is already imported into the workspace.

f. You will notice the Transport Protocol defaults to jca and Endpoint URI points to the JNDI name specified in JDeveloper during Database Adapter configuration (See figure below).

NOTE: The JNDI name is used by the business service to look up the connection factory if the Connection mode is Managed.

Page 45 10/15/01

Oracle Corporation - PROPRIETARY

Use pursuant to Company Instructions

Page 46: OSB - JCA DB Transport Tutorial

Page 46 of 48

4. Configure JCA Transport specific configuration on Business Service

a. Leave all properties as default – Connection Mode is Managed

b. Specify Toplink file

i. You will notice an error message shown below for the Toplink file

ii. Toplink File property -> Click Browse and select the top link mappings xml file (DatabaseInbound_toplink_mappings.xml).

Page 46

Oracle Corporation - PROPRIETARYUse pursuant to Company Instructions

Page 47: OSB - JCA DB Transport Tutorial

Page 47 of 48

5. Finish – You will see the error message go away and the Managed Connection Mode.

6.2.1 Implement proxy service’s message flow

Let’s create a very simple message flow to log the request received by the proxy service. In this case, the records picked by the DatabaseInbound proxy service will be logged to the server console.

1. Create a Pipeline pair

2. On the Request pipeline, add a Stage and a Log action to the Stage.

3. In the log action log $body (this will be data that is retrieved from the database).

a. Set the severity to Debug in the Log action

Page 47 10/15/01

Oracle Corporation - PROPRIETARY

Use pursuant to Company Instructions

Page 48: OSB - JCA DB Transport Tutorial

Page 48 of 48

NOTE: Make sure logging is turned on at Debug level from the WLS Console. Follow instructions in the next section (6.2.1.1).

6.2.1.1 Setting Log level to Debug from WLS Console

From WLS Console

1. Click on Environment->Servers

Page 48

Oracle Corporation - PROPRIETARYUse pursuant to Company Instructions

Page 49: OSB - JCA DB Transport Tutorial

Page 49 of 48

2. Click on Admin Server

3. Select Logging tab

4. Click Advanced

5. Set Minimum severity to Log, Log File – Severity Level and Standard Out - Severity Level to Debug.

6. Click Save and log out of WLS Console

6.3 Deploy and test OSB Proxy Service1. From the Servers tab republish the application

Page 49 10/15/01

Oracle Corporation - PROPRIETARY

Use pursuant to Company Instructions

Page 50: OSB - JCA DB Transport Tutorial

Page 50 of 48

2. Once published the status for the server is updated to Synchronized

3. You must see the following log on the server console. The two records created in the Customer table by executing the business service (DatabaseOutbound) in earlier sections will be picked up by the proxy service and logged.

<Apr 25, 2009 12:47:39 PM PDT> <Info> <ALSB Logging> <BEA-000000> < [PipelinePairNode1, PipelinePairNode1_request, stage1, REQUEST] <soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <dat:CustomerCollection xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:dat="http://xmlns.oracle.com/pcbpel/adapter/db/top/DatabaseInbound"> <dat:Customer>

<dat:name>Pradeep</dat:name><dat:id>1</dat:id><dat:address>5470 Great America Pkwy, Santa Clara,

CA</dat:address></dat:Customer><dat:Customer> <dat:name>Kiran</dat:name> <dat:id>2</dat:id> <dat:address>5470 Great America Pkwy, Santa Clara, CA</dat:address></dat:Customer></dat:CustomerCollection></soapenv:Body>>

4. You can execute the business service (DatabaseOutbound) created earlier multiple times. This will create multiple records in the Customer table. The proxy service (DatabaseInbound) will pick up these records at 5 second intervals and log them to the server console. Each XML document received by the proxy service will contain maximum of 5 records as we set the number of rows per XML Document to 5 during DatabaseInbound adapter configuration in JDeveloper.

Page 50

Oracle Corporation - PROPRIETARYUse pursuant to Company Instructions

Page 51: OSB - JCA DB Transport Tutorial

Page 51 of 48

NOTE: The db adapter uses one thread (The activation spec property, NumberOfThreads, is set to 1 by default) to poll the database. This thread is never released to the pool and hence appears as being stuck to the work manager which can result in stack trace in the system out and server log like the following:

####<Jun 9, 2009 8:13:08 AM CDT> <Error> <WebLogicServer> <jbayer-lap> <xbusServer> <[ACTIVE] ExecuteThread: '21' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1244553188484> <BEA-000337> <[STUCK] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)' has been busy for "610" seconds working on the request "weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl@3a11b5c", which is more than the configured time (StuckThreadMaxTime) of "600" seconds. Stack trace:

Thread-17 "[STUCK] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'" <alive, in native, suspended, waiting, priority=1, DAEMON> { -- Waiting for notification on: oracle.tip.adapter.db.InboundWork@3a11a7d[fat lock]

java.lang.Object.wait(Object.java:???)

oracle.tip.adapter.db.InboundWork.run(InboundWork.java:403)

    oracle.tip.adapter.db.inbound.InboundWorkWrapper.run(InboundWorkWrapper.java:43)

    weblogic.work.ContextWrap.run(ContextWrap.java:39)

    weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)

    weblogic.work.ExecuteThread.execute(ExecuteThread.java:198)

    weblogic.work.ExecuteThread.run(ExecuteThread.java:165)

You can ignore this error log. One can configure a new work manager and set Ignore Stuck Threads to true to not see the stuck thread logged at all. The proxy service can be configured to use this work manager by setting the Dispatch Policy.

Page 51 10/15/01

Oracle Corporation - PROPRIETARY

Use pursuant to Company Instructions