Upload
alex-reichman
View
287
Download
0
Tags:
Embed Size (px)
Citation preview
Interacting with BPEL/Workflow from Oracle Forms 11g
Authored by Alexander Reichman
Interacting with BPEL/WF from Oracle Forms
P a g e | 1
Interacting with BPEL/Workflow from Oracle Forms 11g
Authored by Alex Reichman
November 2011
© (2011) OracleContractors.com. All rights reserved.
All other third party trademarks and registered trademarks are acknowledged.
White Papers by Contractors Network Ltd
This is one of a series of White Papers published by Contractors Network Ltd, each one
focussing on a specific aspect of Oracle.
Further copies of this and other White Papers can be obtained free of charge by contacting us
at [email protected] or the address below.
If you have found the content of this White Paper interesting and useful, and wish to explore
the subject matter further, we can introduce you to independent experts in this field.
Interacting with BPEL/WF from Oracle Forms
P a g e | 2
CONTENTS
White Papers by Contractors Network Ltd ............................................................... 1
ABOUT CONTRACTORS NETWORK ........................................................................... 3
ABOUT THE AUTHOR ................................................................................................ 4
INTRODUCTION........................................................................................................ 5
PURPOSE .................................................................................................................. 6
WHO SHOULD READ THIS ........................................................................................ 6
ORGANISATION OF THIS DOCUMENT ...................................................................... 7
Required software installation and configuration ............................................................. 8
Modifying BPEL Process and deploying Composite ........................................................... 9
Description of Java Class to interact with BPEL/WF ........................................................ 13
Embedding Java Class in Oracle Forms ......................................................................... 14
Running form to communicate with Oracle Workflow engine .......................................... 19
SUMMARY ............................................................................................................... 22
REFERENCES ........................................................................................................... 23
GLOSSARY .............................................................................................................. 24
Interacting with BPEL/WF from Oracle Forms
P a g e | 3
ABOUT CONTRACTORS NETWORK
Contractors Network Ltd is a Global Oracle Contractors Network with primary focus on Oracle's E-Business Suite.
We are operated by Contractors Network Ltd with 8 offices worldwide.
We offer Contractor Resourcing with access to over 10,000 pre-qualified
Oracle Applications Contractors through our local offices.
We provide the only global Oracle specific job search engine with a view of
10,000 + Oracle specific roles.
We interact with over 15,000 client personnel involved with the Oracle E-
Business Suite.
We promote a community spirit through an Apps Blog, with 50 + Regional
Authors that produce 20 articles a months.
We are a Publishing House for White Papers authored by Oracle Contractors
and distribute these free, to clients and Contractors alike.
We offer access for training and demonstration of the latest release via an
online Vision environment at no cost.
We exhibit & present at all Regional Oracle Conferences worldwide as well as local Special
Interest Groups.
Interacting with BPEL/WF from Oracle Forms
P a g e | 4
ABOUT THE AUTHOR
Alex is an certified Oracle DBA and has worked with Oracle Forms from versions 2.0 to 11g.
He also has an experience in migration of forms from client server to WEB and installation
and configuration of Oracle Weblogic Server and Fusion Middleware 11g.
He worked with various industries like Retail, Banking Finance, Accounting, Pharmaceutical,
Automotive
You can reach Alex on [email protected] if you have any comments or feedback
regarding this paper.
Interacting with BPEL/WF from Oracle Forms
P a g e | 5
INTRODUCTION
Some companies which are using different systems are required to integrate the existing
Forms 11g application with Oracle BPEL Workflow included in the Fusion Middleware 11g
platform.
This white paper illustrates how simple forms application can interact with BPEL/WF
Figure 1 shows high-level overview of the process. Employee submit expenses from Web Interface and the task will be automatically assigned to jstein Oracle user ( standard user
from Oracle Weblogic installation). jstein is automatically notified by email about the new task
and has to log on to BPM Worklist in order to approve/reject submitted expenses. This Human Task can be done from Worklist Web Interface or implemented using Java API. In my
case I developed the Java class and embedded it to Oracle Forms using Java Importer. After approving/rejecting submitted expenses employee should be notified about the status of
his/her request.
Figure 1 Expenses Approval process
Interacting with BPEL/WF from Oracle Forms
P a g e | 6
PURPOSE
Today's business requires the integration of different systems and applications.
Service Oriented Architecture (SOA) helps reducing the cost and complexity of integration initiatives.
This white paper illustrates how a simple Oracle Forms Application can interact Oracle BPEL Workflow engine which is a part of Oracle SOA Suite
WHO SHOULD READ THIS
Oracle Forms developers , SOA Architects, Project Managers and anyone else who is interested in integration of Oracle Forms in SOA
Interacting with BPEL/WF from Oracle Forms
P a g e | 7
ORGANISATION OF THIS DOCUMENT
Section Contents Page
Part 1 Required software installation and configuration 8
Part 2 Modifying BPEL Process and deploying Composite 9
Part 3 Description of Java Class to interact with BPEL/WF 13
Part 4 Embedding Java Class in Oracle Forms 14
Part 5 Running form to communicate with Oracle WF
engine
19
Interacting with BPEL/WF from Oracle Forms
P a g e | 8
Required software installation and configuration
Step 1. Download pre-built Virtual Machine for SOA Suite http://www.oracle.com/technetwork/middleware/soasuite/learnmore/vmsoa-172279.html
Step 2. Install Forms 11g services for Linux on this machine to follow this example.
Note: If you downloaded and installed Fusion Middleware 11.1.1.2 please download and install 11.1.1.3 patch because Installation of Forms 11.1.1.2 on WLS 10.3.3 is not supported
(Oracle Support(Metalink) Note: ID 1099203.1)
Check your installation before installing Forms and Reports:
export MW_HOME=/oracle/fmwhome/
cat $MW_HOME/wlserver_10.3/.product.properties | grep WLS_PRODUCT_VERSION
WLS_PRODUCT_VERSION=10.3.3.0 FMW installation 11.1.1.2
Please also make sure Admin Server for SOA domain is up when you will install Forms and Reports. Without that the admin server and manager of both installation can have
configuration problem (same port or overwrite of start-up script)
Step 3. The composite application in this white paper is based on an application SimpleTask
http://redstack.wordpress.com/2010/01/08/human-workflow-in-11g/#comment-298
Follow the steps explained in this blog to create task in Human Workflow and Service Component Architecture (SCA) Composite which should be deployed on local weblogic server.
Interacting with BPEL/WF from Oracle Forms
P a g e | 9
Modifying BPEL Process and deploying Composite I am considering you followed the steps in this blog to create task in Human Workflow and
Service Component Architecture (SCA) Composite.
Let's have look at human task we just created.
1. Start Jdeveloper and open SimpleTask application
2. Open ApproveExpenseClaim.task in designer
3. Go to Assignment page than click on the <Stage1.Participant1> box to highlight it,
and then click on the Edit button
In my case I assigned this task to John Steinbeck (jstein) demo user. In order to make sure
this user will be notified about assigned task let's check his attributes.
1. Open Weblogic administration console (http://localhost:7001/console)
2. Click on Security Realms
3. Click on myrealm and then choose "Users and Groups" tab
4. Click on jstein user open his attributes
5. Specify email address where you want to send email notification about created task
Now when new task will be assigned to jstein user he will be notified by email.
Interacting with BPEL/WF from Oracle Forms
P a g e | 10
Note: In order to enable email notification to Oracle user about assigned task and inform
employee about the status of his/her request you need to configure Oracle SOA Suite 11g for sending email notifications. Please read this article which explains how to implement it
http://technology.amis.nl/blog/6019/configure-soa-suite-11g-for-sending-email-notifications-with-google-mail
In order to notify employee about the status of his/her request to approve submitted expenses we need to customize ExpenseClaimProcess.bpel
Figure 2 SimpleTask Modified BPEL Process
1. Open application SimpleTask in Jdeveloper
2. Open ExpenseClaimProcess.bpel in BPEL editor
3. Drag an Email activity from the Component Palette and drop it under the Assign
Activity.
4. Click twice to specify the configuration for email activity.
Note: In this example I have used my Gmail account [email protected] for both
jstein and employee but in real life it should be two different accounts.
Interacting with BPEL/WF from Oracle Forms
P a g e | 11
Figure 3 Email Activity
5. The content of the message body is defined as follows:
Dear Sir/Madam,
We would like to inform you that the status of your request
<%bpws:getVariableData('ApproveExpenseClaim_1_globalVariable','payload
','/task:task/task:title')%>.
is
<%bpws:getVariableData('ApproveExpenseClaim_1_globalVariable','payload
','/task:task/task:systemAttributes/task:outcome')%>.
Interacting with BPEL/WF from Oracle Forms
P a g e | 12
6. Close Email Activity and open composite.xml
Figure 4 shows you final Composite Application
Figure 4 SCA Composite SimpleTask
7. Deploy the composite application to the SOA Suite
Interacting with BPEL/WF from Oracle Forms
P a g e | 13
Description of Java Class to interact with BPEL/WF
Now it's time to create a Java Class to retrieve and complete a Human Workflow Task which will be called from Oracle Forms Application. This class will contain two methods
1. Query the worklist and retrieve the details for all tasks assigned to user
....
2. Complete ( Approve/Reject) Human Workflow Task
...............
................
Interacting with BPEL/WF from Oracle Forms
P a g e | 14
Jdeveloper project library settings:
For more details about Human Workflow API please refer to SOA Developers Guide available
at http://download.oracle.com/docs/cd/E14571_01/integration.1111/e10224.pdf
Embedding Java Class in Oracle Forms Figure 5 shows the Oracle Forms application which will retrieve and complete a Human
Workflow task. When user will press "Refresh" button getTaskdetails method from Java Class will be called to retrieve the list of tasks assigned to user (jstein). If the task status is
ASSIGNED user can approve or reject the expenses by pressing Approve/Reject button. After pressing one of these buttons approveRejectExpenses method from Java Class will be called
and the status of task will be changed.
Figure 5 Oracle Forms application
Interacting with BPEL/WF from Oracle Forms
P a g e | 15
The embedded class should be available for both Forms developer and the Forms server
because it will be used at design and runtime.
For Forms developer on Unix the correct setting of FORMS_BUILDER_CLASSPATH in
frmbld.sh script should be set (the registry key FORMS_BUILDER_CLASSPATH on Windows )
Figure 6 FORMS_BUILDER_CLASSPATH
On Fusion Middleware server configuration file default.env should be modified. Please make sure to add the jar holding the Java class to the CLASSPATH variable.
Figure 7 default.env CLASSPATH
Interacting with BPEL/WF from Oracle Forms
P a g e | 16
Now we can import Java Class in Oracle Forms.
Select Program->Import Java Classes from Forms Builder Menu. You will see only the classes
that can be found in FORMS_BUILDER_CLASSPATH.
Figure 8 Importing WorkflowTaskForms Java Class
Java Importer examines the Java Class and creates PL/SQL wrapper for it.
Figure 9 shows the package specification containing PL/SQL version of Java methods we
created in Part 3.
Figure 9 PL/SQL wrapper for Java Class
Interacting with BPEL/WF from Oracle Forms
P a g e | 17
Now we need to add the code to WHEN-BUTTON-PRESSED trigger behind Refresh button.
Figure 10 shows a code excerpt for this trigger
The function WorkflowTasksForms.getTaskdetails returns the array of string objects containing the details for each task assigned to user. The main loop is using to retrieve the
task details and populate the form block
Figure 10 WHEN-BUTTON-PRESSED trigger REFRESH button. Loop through the list
of tasks and populate the block
Interacting with BPEL/WF from Oracle Forms
P a g e | 18
In order to complete the task we need to add the code to WHEN-BUTTON-PRESSED trigger
behind Approve and Reject button
Figure 10 shows the code for Approve button. The code for the Reject button is the same as the code in Figure 10, except that you replace the line
WorkflowTasksForms.approveRejectExpenses (:tasks.taskID , 'APPROVE') ;
with the following line:
WorkflowTasksForms.approveRejectExpenses (:tasks.taskID , 'REJECT') ;
Figure 11 WHEN-BUTTON-PRESSED trigger APPROVE button. Approve the task assigned to user
Interacting with BPEL/WF from Oracle Forms
P a g e | 19
Running form to communicate with Oracle Workflow engine
1) Please follow the steps in this blog to submit expenses and create the task for jstein user.
Figure 12 Submit expenses
2) Oracle user jstein receives the following email notification about assigned task
Figure 13 Email notification sent to jstein
Interacting with BPEL/WF from Oracle Forms
P a g e | 20
3) Open BPM Worklist (http://localhost:7001/bpm/workspace/) to see the task assigned to
jstein user
Figure 14 Worklist human workflow web user interface to view assigned task
4) Run Form ( http://localhost:9001/forms/frmservlet?config=default). After pressing Refresh
button we can see the task 200222 was assigned to jstein
Figure 15 Form after querying tasks for jstein - task 200222 was assigned
Interacting with BPEL/WF from Oracle Forms
P a g e | 21
5) Approve the Task 200222 which status is ASSIGNED by pressing Approve button
6) Click on Refresh button again to check the task status. As you can see the status now is
completed.
Figure 16 Task 200222 status is COMPLETED
7) Employee receives the following email notification that his request is approved
Figure 17 Email Notification after approving the expenses
Interacting with BPEL/WF from Oracle Forms
P a g e | 22
SUMMARY
This white paper demonstrated an example of how Oracle Forms Application can interact with BPEL Workflow engine and can be a part of Service Oriented Architecture. The Java Class that
acts as a bridge between Oracle BPEL and Oracle Forms is used to query and complete the tasks assigned to jstein user. Email notification has been sent to jstein user about created
task and to employee to inform him that his/her request is completed.
Interacting with BPEL/WF from Oracle Forms
P a g e | 23
REFERENCES
Configure SOA Suite 11g for sending email notifications with Google Mail
http://technology.amis.nl/blog/6019/configure-soa-suite-11g-for-sending-email-notifications-with-google-mail
Humon Workflow in 11g (SimpleTask Composite Application)
http://redstack.wordpress.com/2010/01/08/human-workflow-in-11g/#comment-298
Oracle Support(Metalink) Note: 1099203.1
Interacting with BPEL/WF from Oracle Forms
P a g e | 24
GLOSSARY