WLMSE Purchase Order Review Sample Instructions

bravesnailsΛογισμικό & κατασκευή λογ/κού

7 Ιουν 2012 (πριν από 5 χρόνια και 4 μήνες)

510 εμφανίσεις

WLMSE Purchase Order Review Sample Instructions
(version 0.7.1.4)
Change Log:
0.7.1.4
1. Added Notes for
OpenESB Installer 20081125 (wlmse must be updated

using this installer)
0.7.1.3
1. Added Notes for
OpenESB Installer 20081125
0.7.1.2
1. Added Notes for
OpenESB Installer 20081024
0.7.1.1
1. Removed the step to edit nbproject/jaxws-build.xml
2. Updated the steps required to build your own web client (if not using the

default WorklistWebApplication
0.7.0.1
1. Added Known Issues to the first page
2. Added Notes for user to skip steps if openESB all-in-one installer is installed
3. Fixed java mail nbm name
4. Fixed typo for SendExpensivePurchaseOrderTestCase
5. Updated the graph in the document to use the latest from WebApp
Table of Contents
WLMSE Purchase Order Review Sample Instructions
..........................................................................
1
Known Issues:
...................................................................................................................................
1
Perquisite:
.............................................................................................................................................
2
Sample Use Case:
.................................................................................................................................
4
Purchase Order sample
...................................................................................................................
4
Steps to run sample projects:
.................................................................................................................
9
Make your own Worklist Manager client application
.........................................................................
18
Known Issues:
http://enterprise.netbeans.org/issues/show_bug.cgi?id=138136

: xform does not get

generated properly under JDK 6, please use JDK 5 for netbeans Java Platform for now
1

Worklist Manager Web application
is best viewed in FireFox (2.0). Although it works on IE,

the visual effect is not exactly the same. We have not yet tested on other browsers.
Perquisite:
Due to a bug (
http://enterprise.netbeans.org/issues/show_bug.cgi?id=138136
), the xform

does not get generated properly under JDK 6, please use JDK 5 for netbeans Java Platform for

now
1.
Install open-esb
a.
Download installer and install all in one package from
https://open-esb.dev.java.net/Downloads.html
**Note: If you are using OpenESB Installer build 20081125, please do step 3 and

then step 6. Normally, step 3 is not required but this build has a particular issue that is

resolved by the latest wlmse
**
Note: If you have installed the openESB all-in-one bundle from 1, go to step 6,
otherwise if you download Netbeans IDE and glassfish separately, continue with step
2
2.
Start glassfish

If you installs a glassfish separately, you need to
c
reate DB connection pool and jdbc resource (
Not needed if glassfish is installed by

OpenESB installer)
For Derby:
asadmin create-jdbc-connection-pool --host localhost --port 4848 --
datasourceclassname org.apache.derby.jdbc.ClientDataSource --restype

javax.sql.DataSource --allownoncomponentcallers=true --property

portNumber=1527:password=WORKFLOW:user=WORKFLOW:serverName=local
host:databaseName=WORKFLOWDB:connectionAttributes=";create\=true"

WorkflowPool
asadmin create-jdbc-resource --host localhost --port 4848 --connectionpoolid
WorkflowPool jdbc/__workflow
3.
Update
wlmse
to use the latest
(
http://download.java.net/jbi/binaries/open-jbi-
components/main/nightly/latest/ojc/worklistmanagerse.jar

)

Note:
wlmse by default is set to 'Test' mode which recreates wlm schema every
time wlmse is started, this is convenient switch for development purpose.
The first time installation will see harmless WARNINGS about Workflow schema does
not exist.
2

4.
Download and install wlm NB plugins
http://download.java.net/jbi/binaries/open-esb-full-install/nbm/latest/org-netbeans-modules-
wlm-model.nbm
http://download.java.net/jbi/binaries/open-esb-full-install/nbm/latest/org-netbeans-modules-
wlm-editor.nbm

http://download.java.net/jbi/binaries/open-esb-full-install/nbm/latest/org-netbeans-modules-
wlm-project.nbm
Note:
T
he 3 plug-ins pre-installed by the installer currently have issues (will be fixed
soon), you will need to uninstall them (WLM Model, Worklist Editor,
Worklist Project and install the 3 from the link.
5.
Download and install smtp plugins (Optional, to use with the notification sample)
http://download.java.net/jbi/binaries/open-esb-full-install/nbm/latest/org-netbeans-soa-
libs-mail.nbm
http://download.java.net/jbi/binaries/open-esb-full-install/nbm/latest/org-netbeans-
modules-wsdlextensions-smtp.nbm

Download and install smtpbc on glassfish
http://download.java.net/jbi/binaries/open-jbi-
components/main/nightly/latest/ojc/smtpbc.jar
6.
Download projects:
Purchase Order sample
(You can deploy one from a , b or c for Purchase Order Sample, but not more than one

because they use the same WSDL )
a. Basic Purchase Order Sample (wlm module, bpel module, compositeApp):
http://wiki.open-esb.java.net/attach/WLMSE/purchaseOrderReview.zip
b. Xpath enabled Purchase Order Sample (wlm module, bpel module, compositeApp):
http://wiki.open-esb.java.net/attach/WLMSE/purchaseOrderReviewXPath.zip
c. Xpath + Escalation +Notification enabled Purchase Order Sample (wlm module, bpel

module, compositeApp):
http://wiki.open-esb.java.net/attach/WLMSE/purchaseOrderReviewNotification.zip
Generic Worklist Manager Web application
The generic Worklist web application works for all wlm projects (Worklist web client

project, compositeApp):
3

**Note:
If you are using OpenESB Installer 20081024 , please download

here

If you are using the latest OpenESB Installer (20081125), please download :

http://wiki.open-esb.java.net/attach/WLMSE/WorklistWeb.zip
Sample Use Case:
Note:
In all samples, 3 files (*.xhtml, *InputInstance.xml, *OutputInstance.xml ) in work list project

src folder are generated by the build process, user may remove them and let system regenerate them

based on schema, the system will not regenerate these files if user does not remove them (to not to

override any modifications made by the user), because of that, if the schema of the input/output is

changed, user has to remove the 3 files to have them regenerated.
Purchase Order sample
Following flowchart shows the use case scenario. An end client submits the purchase order to a
bpel process. If the amount is greater than $200 then bpel process invokes an operation on
WLMSE. WLMSE executes the logic defined in task definition file corresponding to the
operation it implements. In this case a task is assigned to a user/group.
User logs in to Worklist Web application and completes the task. Once the task is completed,
WLMSE sends user's completed response to bpel process. Bpel process after receiving the
response from WLMSE reply back to end client.
This demo also demonstrate support for XForm for out of the box UI for task input and output.
4

Xpath Enabled Purchase Order Sample
The use cae of Xpath enabled Purchase Order Sample is the same as the Basic Purchase Order

Sample, however it allows dynamic assignment and dynamic task variables (see
http://wiki.open-
esb.java.net/Wiki.jsp?page=WLMSEXPath
)
The Xpath in Task Definition File:

5

Task Priority, Title, Assignees, initial Approve Result are all assigned from either TaskInput or literal

value.
Another aspect might be of interest is the generated Xform can be modified to suit your need. In this

case, the generated input form has Priority and Users fields that we do not want to show to the users,

we can just modify the generated ApprovePurchaseXform.xhtml to remove them :
6

Note:
If the xform is present in the project, it will not be overwritten by the build, to regenerate anew, you

need to remove *.xhtml and *Instance.xml from src folder.
Notification and Escalation in Purchase Order Sample
PurchaseOrderWorklistAppNotification shows an example of using Notification and Escalation,

currently, wizard and editor for creating notification and escalation are having a few issues, to work

around, please check out the sample and use the task definition (.wf) schema below to create the task

definition
http://wiki.open-esb.java.net/attach/WLMSE/wfse_def.xsd
Configure SMTP binding for Notification:
You will need to add SMTP binding info on

purchaseOrderReviewNotification\PurchaseOrderCompositeAppNotification\src\jbiasa\PurchaseOrder
CompositeAppNotification.wsdl to send mails:
7

Note:
In your own project, you will need to add binding for the message property in addition to smtp address

binding above:
8

Steps to run sample projects:
Note:
We use Basic Purchase Order Sample to show the steps, you can apply the same steps to any

other samples
(1)
Open all 5 projects in netbeans :
(2)
Start glassfish and make sure sun-javaee-engine, sun-bpel-engine and sun-wlm-engine are

started
(3)
Go to admin console and login using user name admin and password adminadmin.
9

(4)
Create a new user under Configuration/Security/Realms/file by clicking on Manage Users.
10

(5)
Create a new user as below and hit ok:
User ID : john
Group List : CustomerServiceRep
New Password: john
Confirm New Password : john
11

(6)
Clean, build and deploy WorklistWebCompositeApp
(7)
Clean, build and deploy PurchaseOrderCompositeApp
Note:
In the composite App casa diagram, the link between BPEL and WLM is manually

created, the sample has already created it. In user's own compositeApp, linking the provider and

consumer between BPEL and WLM is necessary.
(8)
Go to worklist web app at
http://localhost:8080/WorklistWebApplication/wlm-jsp/wlmEntry.jsp

and enter user john and password john.
12

You will see emtpy task list:
(9)
Now run SendExpensivePurchaseOrderTestCase in PurchaseOrderCompositeApp to create a

task from a bpel process instance
13

(9)
You will note that worklist web app has a new task ( it is AJAX enabled )
(10)
Note the task is assigned to CustomerServiceRep as defined in ApprovePurchase.wf file, since

you are assigned as 'john' and 'john' has the role as 'CustomerServiceRep' (configured in file

realm in Step (5)). you can see the task and claim this task. You can click on task to see task

details. Since task is not checked out it shows only task input details in generated Xform
14

(11)
Click on checkout to checkout task.
Note: The respond time is longer when the web application is launched the first time since all JSP

pages are to be compiled.
After about 5 sec you will see that task is now claimed by user john as shown in “Claimed By” column.
15

(12)
Click on task again to see task details. This time, both task input and output details are shown

in generated xform.
(13)
Select Approve from drop down and add some description and hit submit (you will see

“loading ...” on the right corner of the form till it is updated in the database) . The output on the

form contains the content you typed.
16

(14)
Click on complete button to complete the task and the task disappeared from the task list

(without the need to refresh the page)
17


(15)
You can verify in the composite app tester output that a response is obtained which similar to

what user submitted from the worklist web app, i.e. The bp process instance receives the

response from wlm and sends the response to complete the test case
(16)
This completes the Human Interaction demo in a business process using WLMSE.
Notes:

The WorklistWebCompositeApp is designed to work with any worklist projects, so you only

need to deploy it once and use it to work with different tasks from multiple worklist projects
Make your own Worklist Manager client application
Your can create your own worklist manager client application by invoking TaskCommonService

provided by wlmse
(1)
Obtain TaskCommon.wsdl
Currently, TaskCommon.wsdl is not published on a URL, however, you can obtain it by doing a

build on your worklist project and see it in the build folder
18

(2)
Create web service client in your web application to invoke TaskCommonService in

TaskCommon.wsdl
You may create the web service client using Netbeans (New --> Web Service Client), point to

the TaskCommon.wsdl in the file system.
Note:
a. You can specify package name and not using the wrapper by selecting the web service reference and

choose “Edit Web service attributes” from context menu (The sample uses this setting):
19

b. Due to
http://www.netbeans.org/issues/show_bug.cgi?id=146099
, currently, the absolute file path of

wsdl file is referenced as –wsdllocation in wsimport when the project is built, it breaks the portability

when the project is moved from environment to environment. A workaround is described below:
Workaround to avoid portability issue associated with absolute file path reference to wsdl file :
Open nbproject/jaxws-build.xml of your web project, find the target wsimport-client-TaskCommon and

change the value of the wsdlLocation to use a relative file path to point to an existing

TaskCommon.wsdl. You may copy the TaskCommo.wsdl to your project and use ant task to copy the

file into build directory, please see in build.xml of WorklistWebApplication :
<target name="-pre-compile">







<!-- Empty placeholder for easier customization. -->







<!-- You can override this target in the ../build.xml file. -->








<copy todir="${build.classes.dir}">











<fileset dir="${webinf.dir}" includes="TaskCommon.wsdl"/>







</copy>



</target>


This above task effectively copies the TaskCommo.wsdl from web/WEB-INF directly to build/classes

directory which is the top directory of all compiled java classes.
Then, in nbproject/jaxws-build.xml, use relative path for wsimport -wsdlLocation, e.g







<wsimport xendorsed="true" package="com.sun.workflow.client" verbose="true"

sourcedestdir="${build.generated.dir}/wsimport/client" extension="true"

destdir="${build.generated.dir}/wsimport/binaries" wsdl="${basedir}/${conf-dir}xml-resources/web-
service-references/TaskCommon/wsdl/TaskCommon.wsdl"

wsdlLocation="../../../../TaskCommon.wsdl"
catalog="catalog.xml"
/>
The wsdlLocation points to the file just copied into build/classes. This file will be referenced to at

runtime.
Currently, due to
https://glassfish.dev.java.net/issues/show_bug.cgi?id=6810
, a workaround has to be

made to make the web component serving as web service client work. Please look at nbproject/jaxws-
build.xml, modify the ant target accordingly in your project:



<target name="wsimport-client-compile" depends="-pre-pre-compile">








<replace

file="${build.generated.dir}/wsimport/client/com/sun/workflow/client/TaskCommonService.java">











<replacetoken><![CDATA[baseUrl =

com.sun.workflow.client.TaskCommonService.class.getResource(".");]]></replacetoken>











<replacevalue><![CDATA[baseUrl =

com.sun.workflow.client.TaskCommonService.class.getResource(".");











if (baseUrl == null) {















baseUrl = com.sun.workflow.client.TaskCommonService.class.getResource("");











}]]></replacevalue>







</replace>
20








<webproject2:javac srcdir="${build.generated.dir}/wsimport/client"

classpath="${j2ee.platform.wsimport.classpath}:${javac.classpath}" destdir="${build.classes.dir}"/>



</target>
(3)
Use the generated classes in your web application to invoke operations on TaskCommon.wsdl
(4)
Create a composite App to wrap your web application
(5)
Add an External Service Unit: WLMSE-TaskCommon
(6)
Type Interface Name, Service Name, Endpoint Name for WLMSE-TaskCommonPort as below:
21

22


(7)
Disable the TaskCommonPort on the LEFT WSDL Ports section
23

(8)
Connect WLMSE-TaskCommonPort with javaee-TaskCommonPort
24

(8)
Build and Deploy the Worklist Composite App
25