Oracle ESB: CustomerData Tutorial

Setup JDev

* Install JDev 10.1.3.3

Create a new Application Server connection

* Click “Connections” tab,
* Right click “Application Server”,
* Select “New Application Server Connection…”

Name: LocalApplicationServer
Connection Type: Oracle Application Server 10g 10.1.3
User name: oc4jadmin
Pass: welcome1
Connect to: Single Instance
Host name:  localhost   
OPMN Port: 6003
OC4J instance name: home

Create a new Integration Server connection

* Click “Connections” tab,
* Right click “Integration Server”,
* Select “New Integration Server Connection…”

Name: LocalIntegrationServer
Application server: LocalApplicationServer
Host name: localhost
Port number: 8888

Unzip CustomerSample.zip

* CustomerSample.zip is in ‘OracleAS_1\integration\esb\samples\tutorials\CustomerData’
* Unzip it into C:\

Create JDev Application and Project

Create a JDev Application named ‘ESBSamples’

* Click “Applications Navigator” tab,
* Right click “Applications”,
* Select “New Application…”,
* Enter application name,
* Click “OK”,
* Click “Cancel” on Create Project dialog.

Create a JDev ESB Project named ‘CustomerData’

* Click “Applications Navigator” tab,
* Right click “ESBSamples”,
* Select “New Project…”,
* Select “General -> Projects -> ESB Project”,
* Click “OK”.

Import XSD Files

* Click “CustomerData” ESB project
* Click “File -> Import…”
* Select “Web Source”, click “OK”
* Browse to ‘C:\Customer\Schemas’
* Select all three schema files, click ‘OK’

Create an ESB System

* Click ‘Create System/Group’ icon on the center panel.
– Create: System
– Name: CustomerData
* Click ‘OK’

Create an Inbound File Adapter Service: CustIn

* Drag ‘Component Palette -> Adapter Services -> File Adapter’ onto ‘CustomerData.esb’ design area in the center panel.
* Define file adapter service:

Name: CustIn
System/Group: CustomerData

* Click ‘Configure Adapter Service Wsdl’ icon to the right of WSDL File field.

Service name: CustIn
Operation type: Read File
Operation name: ReadCustomerData
Directory for Incoming Files (physical path): C:\Customer\In
Include Files with Name Pattern: *.xml
Polling frequency: 1 sec
Schema location: Type Explorere -> Project Schema Files -> LegacyCustomer.xsd -> CustomerData
Schema element: CustomerData

* Click ‘Finish’
* Click ‘OK’
* ‘CustIn_RS’ routing service is also created automatically.

Create an Outbound Database Adapter Service: CustDBOut

Create OLite ‘CUSTOMER_DATA’ table

cd C:\oracle\product\10.1.3.1\OracleAS_1\integration\esb\olite\bin
sql_olite.bat @C:\Customer\create_customer.sql

Create CustDBOut

* Drag ‘Component Palette -> Adapter Services -> Database Adapter’ onto ‘CustomerData.esb’ design area in the center panel.

Name: CustDBOut
System/Group: CustomerData

* Click ‘Configure Adapter Service Wsdl’ icon to the right of WSDL File field.
– Service name: CustDBOut
– Connection: click ‘New’

Connection name: Olite
Connection type: Oracle Lite
User name: system
Pass: any
Driver: Type 4 Driver
Library: Olite40.jar
Classpath: C:\oracle\product\10.1.3.1\OracleAS_1\integration\esb\lib\olite40.jar
Host name: localhost
JDBC port: 1531
SID: OraESB

* Click ‘Test Connection’, should return Success
* Click ‘Finish’

Connection is now: Olite
User name: system
Driver: oracle.lite.poljdbc.POLJDBCDriver
Connection string: jdbc:polite4@localhost:1531:OraESB
JDDI name: eis/DB/Olite

* Operation type: Perform an operation on a table -> Insert or Update (Merge)
* Import Tables: SYSTEM.CUSTOMER_DATA
* Primary key: CUSTOMERID
* Click ‘Finish’
* Click ‘OK’

Create an Outbound JMS Adapter Service: CRMOut

* Drag ‘Component Palette -> Adapter Services -> JMS Adapter’ onto ‘CustomerData.esb’ design area in the center panel.
* Define jms adapter service:
– Name: CRMOut
– System/Group: CustomerData
* Click ‘Configure Adapter Service Wsdl’ icon to the right of WSDL File field.
– Service name: CRMOut
– OEMS: Memory/File
– Connection: LocalApplicationServer
– Operation type: Produce Message
– Operation name: Product_Message
– Destinations: demoTopic (topic)

Destination name: jms/demoTopic
JMS Connection Factory: jms/TopicConnectionFactory
Message body type: TextMessage
Delivery mode: Persistent
Priority: default
TimeToLive: 0
JNDI name: eis/Jms/TopicConnectionFactory

– Schema location: browse to ‘Type Explorer -> Project Schema Files -> CommonCustomer.xsd -> Customer’
– Schema element: Customer
– Click ‘Finish’
* Click ‘OK’

Create an Outbound Routing Service: CustOut_RS

* Drag ‘Component Palette -> ESB Services -> Routing Service’ onto ‘CustomerData.esb’ design area in the center panel.
* Define routing service:
– Name: CustOut_RS
– System/Group: CustomerData
* Select ‘Generate WSDL from Schema’
– Schema location: browse to ‘Type Explorer -> Project Schema Files -> CommonCustomer.xsd -> Customer’
– Schema element: Customer
– Operation name: MapCustomerData
– Namespace: http://oracle.com/esb/namespaces/CustomerData

Specify Routing Rules for CustIn_RS and CustOut_RS

* Double click CustIn_RS

Specifying Routing Rules from CustOut_RS to CustDBOut

* Double click CustOut_RS
* Expand Routing Rules
* Click ‘+’ sign to the right of MapCustomerData
– Select ‘ESB/Services in project/CustDBOut/write’
* Click ‘H’ icon to the right of <>
– Select ‘Create New Mapper File:’
– Click ‘OK’
– Drag ‘inp1:Customer’ to ‘top:CustomerData’
~ Check ‘Enable Auto Map’
~ Check ‘Prompt for Preferences before Auto Map’
~ Mode: Basic
~ Check ‘Match Elements with Similar Names’
~ All others deselected. Especially, deselect Match Elements Considering their Ancestor Names
* Click OK

Specifying Routing Rules from CustOut_RS to CRMOut

* Double click CustOut_RS
* Expand Routing Rules
* Click ‘+’ sign to the right of MapCustomerData
– Select ‘ESB/Services in Project/CustomerData/CRMOut, select Produce_Message’

Adding an Expression Filter to the CustOut_RS Routing Service

* Double click CustOut_RS
* Click the filer icon for ‘CustDBOut::write’
* In the WSDL Message box, expand Customer_request/Customer/inp1:Customer/Address
* Select Country.
* Click ‘Insert Into Expression’.
* Specify the country as “US”: /inp1:Customer/Address/Country=’US’
7. Click OK.

Register Services with Oracle ESB

* Right click ‘Application Navigator/Applications/ESBSamples/CustomerData/’
* Select ‘Register with ESB/LocalIntegrationServer’
* Click OK

View Services in Control Console

Running the Tutorial

* Copy ‘C:\Customer\LegacyCustomer.xml’ to ‘C:\Customer\In’ directory.
* ‘C:\Customer\In\LegacyCustomer.xml’ disappears.
* Query OLite

...OracleAS_1\integration\esb\olite\bin>msql.exe system/any@jdbc:polite4@127.0.0.1:1531:oraesb
 
SQL> SELECT customerid,name,country FROM customer_data;
CUSTOMERID | NAME                  | COUNTRY
-----------+-----------------------+--------
A22-9AXC2  | Deserae International | US
 
1 ROW(s) returned

References

* http://download.oracle.com/docs/cd/B31017_01/integrate.1013/b28212.pdf

This entry was posted in esb, oracle. Bookmark the permalink.