Friday, October 23, 2009

Oracle ADF 2 SOA via Event Delivery Network

EDN takes the pain out of messaging - providing more business / IT alignment. For more info please see
http://blogs.oracle.com/soabpm/2009/07/event_delivery_network_chapter.html


In this simple lab I will detail how to raise a business event in an ADF app (in this case, it is the creation of a new order) and consume the event in a SOA app. Pub/Sub at a higher level.


0. Create the ORDERS DB table

0.1. run the following in SQLPLUS

drop table orders;

Create table orders(
order_nr varchar2(20) not null,
customer varchar2(50) not null,

email varchar2(50) not null,
country varchar2(50) not null,
phone varchar2(50) not null,
product varchar2(50) not null,
quantity number(10) not null,
unitPrice number(10,2),
supplier varchar2(50) ,
totalPrice number(10,2),
orderStatus varchar2(50) ,
comments varchar2(256)
);

ALTER TABLE orders ADD PRIMARY KEY (order_nr);


1. Create the ADF App

1.1. Create a new application of type Fusion Web app in JDeveloper
1.2. In the Model project - Create a new ADF BC for the ORDERS table
1.3. Open the Entity Object definition



1.4. Add an Event Definition
1.4.1. Select all of the Entity Object attributes


1.4.2. Define Event Publication
Here we publish an event whenever a new order is created.


2. Create the UI

2.1. Create 2 pages
2.1.1. browseOrders.jspx
2.1.2. createOrder.jspx
2.2. Create 2 navigation cases
2.2.1. create – from browseOrders to createOrder
2.2.2. return – from createOrder to browseOrders



2.3. browseOrders.jspx

2.3.1. Drop the orders DataControl onto the page as an ADF Read Only Table
2.3.2. Drop the CreateInsert operation as an ADF button



2.3.3. Rename button to Create Order.

2.3.4. Set button action attribute to create



2.4. createOrder.jspx

2.4.1. Drop the orders DataControl onto the page as an ADF Form
2.4.1.1. Include Submit button
2.4.2. Drop the Commit & Rollback operations as ADF buttons
2.4.2.1. Set the disabled attribute for both buttons to false.


3. Create a SOA App to consume the event

3.1. Create a new SOA Application



3.2. Copy the EDL and XSD schema files from the ADF app to the SOA project's root directory. For example:
D:\jdevinstance\mywork\SOA-ADF-EDN\SOA-ADF-EDN

e.g.

From



To



3.3. Create a Mediator in the SOA app to subscribe to the event



3.4. Create an outbound File Adapter, we will simply write the new order to a file.
3.4.1. Firstly create the output directory e.g. out



3.5. Create the FileAdapter







3.6. Wire to Mediator

3.7. Create the data mapper for Mediator--> FileAdapter



4. Deploy the 2 apps

4.1. Deploy the composite to soa_server1
4.2. Deploy the ADF app to soa_server1
4.2.1. Before deploying, set the BC configuration to use J2EE Datasources





4.3. Define a new datasource ,jdbc/scottDS, in the WLS Console




4.3.1. Test the Connection

4.3.2. Target Datasource to soa_server1



5. Test the App

e.g.
http://localhost:8001/ADF-EDN-ViewController-context-root/faces/createOrder.jspx

If you have issues with the URL, then check your app context root in JDeveloper
Right click on the ViewController project --> Project Properties

5.1. Click Create Order




5.2. Click Submit and then Commit.



5.3. Check for a new instance of SOA-ADF-EDN in the SOA Console



5.4. Check the output directory

No comments: