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

Thursday, October 22, 2009

Composite Status in SOA Suite 11g console

The Composite instance completes successfully however the state is not updated in the instance list? Then check that you have the following set -



Tuesday, October 20, 2009

EMAIL Activation with Oracle SOA Suite 11g

In the previous post I described how to configure/send an email from BPEL. Here we will consider processing the email response. In this simple example, the customer order is processed in BPEL and an email is sent to jcooper informing him of the task requiring his attention. The email will contain a link to access the Worklist app and also 2 links -
to either"Approve" or "Reject" the order.



Again this simple demo uses Apache James.



Pre-requisites


1. Upload the demo users (jcooper etc.) to SOA Suite 11g.
Note: jcooper is assigned the email address jcooper@emailExample.com

The utility to lad the demo users is available at
http://www.oracle.com/technology/products/soa/hw/samples/workflow-001-DemoCommunitySeedApp.zip

2. Configure email users on James
I've added the following users

- adduser bpelinbox welcome1
- adduser bpelsender welcome1
- adduser jcooper welcome1


Configure James to use the server name emailExample.com by editing the file apps/james/SAR-INF/config.xml



3. Add emailExample.com to your /etc/hosts file
e.g. 127.0.0.1 emailExample.com

4. Configure MSFT Outlook for the 3 email addresses you created in James


Here is the configuration for jcooper, just adapt the same for the other 2 email accounts.










Configure UMS on FMW11g

Set Workflow Notification Properties as follows –





Configure usermessagingdriver-email as follows -


James uses the Pop3 protocol for incoming mails. When you start up James you see

that Pop3 is running on port 110.


So essentially all we need to set here for incoming mails are the following properties -

MailAccessProtocol --> POP3
ReceiveFolder --> INBOX
IncomingMailServer --> emailExample.com
IncomingMailServerPort --> 110
IncomingMailIDs --> bpelinbox@emailExample.com
IncomingUserIDs --> bpelinbox
IncomingUserPasswords -->
--> Type of Password --> Use clear...
--> (password = welcome1)









Make sure James is up and running



Create a simple BPEL process that includes Human Workflow



I am using the following order.xsd as input & output


The definition of the Human Workflow component is as follows -

Note: Make notification actionable needs to be checked.





Parameters- (what is to be approved) is set to element of type order

Possible outcomes are Approve or Reject

The task is being assigned to jcooper




Deploy and Test

The reminder email arrives in jcooper's Inbox




Here I click on the "Reject" link
The Composite process completes with the Outcome - REJECT


































































Monday, October 19, 2009

EMAIL notifications with Oracle SOA Suite 11g

In this example we will use Apache JAMES as our email server and MS Outlook as email client.

We will configure SOA Suite to use James and then we shall create a simple BPEL process to send an email.

· Download from http://james.apache.org/
· Unzip to a directory of your choice
· Start James



telnet into James and create a couple of users

o telnet localhost 4555
o root/root
o adduser bpelsender welcome1
o adduser bpelreceiver welcome1
o adduser jcooper welcome1



Configure Email client for jcooper, bpelsender etc.
· Configure your email client e.g. MS Outlook
o Tools --> Accounts




Configure SOA Suite 11g EMAIL




Set the following Email Driver Properties -

Sender Addresses = bpelsender@localhost
Default Sender Address = bpelsender@localhost
Outgoing Mail Server = localhost
Outgoing Mail Server Port = 25
Outgoing Mail Server Security = none
Outgoing Default From Addr = bpelsender@localhost


Set the following Workflow Notification Properties -

right mouse click soa-infra --> SOA Administration --> Workflow Notification Properties

Notification Mode = Email




Restart soa_server1


Create a simple BPEL composite that sends an email




Test