Вы находитесь на странице: 1из 26

Training Tutorial: Oracle BAM - BPEL Sensors

(tutorial for bpel-bamsensors and bam adapter.doc)



tutorial Ior bpel-bamsensors and bam adapter.doc
Page 1 oI 26
June, 2009 (version 11.1.1.0.0)
Document version (2)
Oracle conIidential, All rights reserved
Supported Version: Oracle BAM 11.1.1.0.0
Note : II you use Oracle SOA (BPEL &BAM)11.1.1.2.0 or higher & corresponding
JDEV, you will Iind the Sensors in the monitor perspective in JDEV. By deIault, JDEV
opens the project in BPEL perspective.

Objectives:
This lab exercise will give you a brieI introduction to using BAM Adapters and BAM
Sensors in a SOA Composite.
BAM provides the ability Ior end-users to create real-time business dashboards.
To illustrate the usage oI BAM Adapter and BAM Sensors, you will modiIy the existing
POProcessing composite to send the orders as they are received to the BAM dashboard
and Ior large orders update the status in the BPEL process.




Prerequisite:
Basic knowledge oI Oracle BAM and installed Oracle BAM soItware.


Initial Projects and Set-up:
To do this lab you need to start by unzipping the 'POProcessing.zip Iile and open in
JDeveloper the "CreditCardValidation" and "POProcessing" projects (which can be Iound
in the 'po\POPROCESSING SOLUTION directory. JDeveloper should be conIigured
with the soa-jdev-extension.

Training Tutorial: Oracle BAM - BPEL Sensors
(tutorial for bpel-bamsensors and bam adapter.doc)

tutorial Ior bpel-bamsensors and bam adapter.doc
Page 2 oI 26
June, 2009 (version 11.1.1.0.0)
Document version (2)
Oracle conIidential, All rights reserved
Follow the Setup instructions as listed in a POProcessingSetup.doc. AIter that is
completed, you should deploy the 'CreditCardValidation composite and deploy the
'ApproveTaskDetails human task. Instructions to complete these two tasks are Iound in
'Appendix A sections 4 and 5. Appendix A also explains how to start the servers, create
connections Irom JDeveloper and how to test your deployed composites using Enterprise
Manager.
Training Tutorial: Oracle BAM - BPEL Sensors
(tutorial for bpel-bamsensors and bam adapter.doc)

tutorial Ior bpel-bamsensors and bam adapter.doc
Page 3 oI 26
June, 2009 (version 11.1.1.0.0)
Document version (2)
Oracle conIidential, All rights reserved
1able of Contents
Part 1a: Creating Dataobjects in BAM ............................................................................... 4
Part1b: Creating a simple BAM Dashboard ....................................................................... 7
Part 2: ConIigure BAM Adapter on WebLogic Server .................................................... 11
Part 3: Creating a BAM Connection ................................................................................. 13
Part 4: Adding a BAM Service Adapter ........................................................................... 14
Part5: Testing BAM Integration with the BAM Adapter ................................................. 18
Part 6: Adding BAM Sensors to the BPEL Process ......................................................... 20
Summary: .......................................................................................................................... 26

Training Tutorial: Oracle BAM - BPEL Sensors
(tutorial for bpel-bamsensors and bam adapter.doc)

tutorial Ior bpel-bamsensors and bam adapter.doc
Page 4 oI 26
June, 2009 (version 11.1.1.0.0)
Document version (2)
Oracle conIidential, All rights reserved

Part 1a: Creating Dataobjects in BAM
In this step, you create a data object in BAM to store data related to incoming purchase
orders.
Defining the data object
1. Start your BAM server and go to http://localhost:9001/OracleBAM and login with
the username and password you deIined when you created the domain.




2. Open the 'Architect application.

3. Click on the Data Objects link in the directory tree and then the 'Create
subIolder link on the right. Enter 'Training and click the 'Create Iolder button.
Training Tutorial: Oracle BAM - BPEL Sensors
(tutorial for bpel-bamsensors and bam adapter.doc)

tutorial Ior bpel-bamsensors and bam adapter.doc
Page 5 oI 26
June, 2009 (version 11.1.1.0.0)
Document version (2)
Oracle conIidential, All rights reserved

4. Click 'Continue and 'Create subIolder again. Name it 'End2End-105-
POProcessing or another preIerred name. Click 'Continue.

5. Add a new data object by clicking on the 'Create Data Object link.
6. Call the data object 'Orders and add the Iollowing data Iields with the
corresponding types and max sizes or scale.

Name Type Max Size or ScaIe
Crder lu SLrlng 30
CusLomer lu SLrlng 30
roducL name SLrlng 30
lLem 1ype SLrlng 30
rlce ueclmal 10
CuanLlLy ueclmal 10
SLaLus SLrlng 30
1oLal CalculaLed -
8ecelved uaLe 1lmesLamp -
Training Tutorial: Oracle BAM - BPEL Sensors
(tutorial for bpel-bamsensors and bam adapter.doc)

tutorial Ior bpel-bamsensors and bam adapter.doc
Page 6 oI 26
June, 2009 (version 11.1.1.0.0)
Document version (2)
Oracle conIidential, All rights reserved

7. Note, when you choose 'Calculated, you get the option to edit the Iormula. In
the pop-up box enter: Price ` Quantity and click 'OK.

8. When you are ready, click 'Create Data Object.

9. You should now see a data object listed on the leIt hand side. You can click on the
'Orders link and choose the 'layout link Irom the leIt hand side to see the
layout.
Training Tutorial: Oracle BAM - BPEL Sensors
(tutorial for bpel-bamsensors and bam adapter.doc)

tutorial Ior bpel-bamsensors and bam adapter.doc
Page 7 oI 26
June, 2009 (version 11.1.1.0.0)
Document version (2)
Oracle conIidential, All rights reserved

Part1b: Creating a simple BAM Dashboard
10.Next you create a simple report based upon the data. To do that, you can close the
architect window and go back to the 'BAM Start Page window and choose
'Active Studio.

11.This will open up the report creation environment. You will create a report that
everyone can view, so click on 'Shared Reports.

12.To keep reports organized, you will want to create Iolders to put them in. Choose
'Create a new Iolder and name the Iolder 'Training. You can double-click on
the new Training Iolder and create a subIolder called 'End2End-105-
POProcessing.
13.Double-click on 'End2End-105-POProcessing and then click the 'Create A New
Report button. BAM provides some pre-deIined layout templates Ior your report.
14.Click on the one that gives you a large rectangle area at the top and 2 small square
areas underneath (1st column, 3rd row).
Training Tutorial: Oracle BAM - BPEL Sensors
(tutorial for bpel-bamsensors and bam adapter.doc)

tutorial Ior bpel-bamsensors and bam adapter.doc
Page 8 oI 26
June, 2009 (version 11.1.1.0.0)
Document version (2)
Oracle conIidential, All rights reserved

15.Give the report the title 'PO Processing Report by clicking and typing in the title
bar at the top. Notice that you are provided with many options Ior types oI charts
that you can create.

16.For the top, choose 'Updating Ordered List by clicking on that type. You will
need to speciIy the data object to assign. At the bottom oI the screen, Iind the data
object that you created by double-clicking on the 'Training and then the
Training Tutorial: Oracle BAM - BPEL Sensors
(tutorial for bpel-bamsensors and bam adapter.doc)

tutorial Ior bpel-bamsensors and bam adapter.doc
Page 9 oI 26
June, 2009 (version 11.1.1.0.0)
Document version (2)
Oracle conIidential, All rights reserved
'End2End-105-POProcessing Iolders and selecting the 'Orders data object,
then click 'Next.

17.Click 'select all and use the arrows to put the columns in a more user-Iriendly
order, starting with the Order ID, then click 'Next, then click 'Finish.

18.We need to Iollow a similar process Ior the order two views. On the lower leIt
hand-side click on '3D Pie Chart.

19.Assign the 'Orders data object and click 'Next.
20.Choose 'Item Type as the 'Group By option, 'Total as the 'Chart Values and
with 'Total still selected, unselect 'Sum and instead choose 'Percentage oI
Total as the Summary Function, then click 'Next.

21.Let`s change some more options by clicking on 'Change View Properties.
22.Change the 'View Title to 'Percentage oI Total Sales by Item Type and click
'OK.
Training Tutorial: Oracle BAM - BPEL Sensors
(tutorial for bpel-bamsensors and bam adapter.doc)

tutorial Ior bpel-bamsensors and bam adapter.doc
Page 10 oI 26
June, 2009 (version 11.1.1.0.0)
Document version (2)
Oracle conIidential, All rights reserved

23.Set the Iinal chart to '3D Bar Chart.

24.Assign the 'Orders data object to it and group by: 'Status, make the chart
values 'Order ID and the summary Iunction 'Count.

25.Click 'Next and Choose 'Change View Properties to set the title oI the view to
'Purchase Orders by Status and click 'OK.
26.Click on the Save Report link, and then choose the 'Shared Reports button.
Drill-down into the Training/End2End-105-POProcessing Iolder and accept the
deIault report name 'PO Processing Report and click 'OK.


Training Tutorial: Oracle BAM - BPEL Sensors
(tutorial for bpel-bamsensors and bam adapter.doc)

tutorial Ior bpel-bamsensors and bam adapter.doc
Page 11 oI 26
June, 2009 (version 11.1.1.0.0)
Document version (2)
Oracle conIidential, All rights reserved
Part 2: Configure BAM Adapter on WebLogic Server
In this step, you conIigure the WebLogic Server that is running the SOA composites with
the correct settings Ior the BAM adapter.
Edit the BAM Adapter Configuration
27.You need to conIigure the BAM adapter using the WebLogic Server
administration console in order to connect to a BAM server Irom a SOA
composite. Go to http://localhost:7001/console and login with the username &
password that you created Ior the domain.
28.Click on Deployments under the Domain Structure.
29.Use the 'Next link to Iind the 'OracleBamAdapter.

30.Click on the OracleBAMAdapter -~ ConIiguration -~ Outbound Connection
Pools.
31.Expand oracle.bam.adapter.adc.RMIConnectionFactory and click on eis/bam/rmi
32.Enter the host name oI the BAM server, username, password and port 9001. The
values can be edited by clicking on the Property value.
33.Make sure you press 'Enter aIter setting each value. Click Save.
Training Tutorial: Oracle BAM - BPEL Sensors
(tutorial for bpel-bamsensors and bam adapter.doc)

tutorial Ior bpel-bamsensors and bam adapter.doc
Page 12 oI 26
June, 2009 (version 11.1.1.0.0)
Document version (2)
Oracle conIidential, All rights reserved



34.Create a BAMPlan directory as Iollows: ../OracleSOA1/soa/BAMPlan
35.Save the plan Plan.xml in the new directory

36.Update your deployment to reIlect the changes. Go to the Deployments screen
and select the checkbox Ior 'OracleBamAdapter and choose 'Update.
37.Click 'Finish to Iinish updating the deployment.
Training Tutorial: Oracle BAM - BPEL Sensors
(tutorial for bpel-bamsensors and bam adapter.doc)

tutorial Ior bpel-bamsensors and bam adapter.doc
Page 13 oI 26
June, 2009 (version 11.1.1.0.0)
Document version (2)
Oracle conIidential, All rights reserved

38.Click 'Finish to Iinish updating the deployment.

Part 3: Creating a BAM Connection
You need a connection to the BAM server to view the data objects that are available to
enable JDeveloper to generate appropriate WSDL Iiles automatically.

39.Open the POProcessing application.
40.Create a connection to the BAM server by right-clicking on Connections in the
Application Resources navigator and choosing 'New Connection, 'BAM.


41.In Step 1 (the Name screen), select Application Resources, accept the deIault
name 'BAMServerConnection1 and click 'Next.

42.Enter the host name oI your server Ior 'BAM Web Host and 'BAM Server
Host.
43.Enter the HTTP port Ior BAM in the 'HTTP Port Iield.
Training Tutorial: Oracle BAM - BPEL Sensors
(tutorial for bpel-bamsensors and bam adapter.doc)

tutorial Ior bpel-bamsensors and bam adapter.doc
Page 14 oI 26
June, 2009 (version 11.1.1.0.0)
Document version (2)
Oracle conIidential, All rights reserved
Hint: The HTTP port Ior BAM is in the URL Ior the Oracle BAM start page. For
example: http://localhost:91/OracleBAM/. It is the port number that was deIined Ior
the managed server 'bamserver1 when you ran the conIiguration wizard. The deIault is
9001.

44.Enter the user name and password
45.Click Next but on the Test Connection page, do NOT click the "Test Connection"
button. A bug in this version will cause problems later with deployments.
46.Click the 'Finish button.
47.In the Application Navigator, Application Resources pane, the new BAM Server
connection is listed in the Connections section under the BAM node.

Part 4: Adding a BAM Service Adapter
In this step, you deIine the BAM service adapter which contains the parameters needed to
communicate with BAM.
You can add a BAM Service Adapter to the composite to send messages into BAM.
48.Drag the 'BAM Adapter icon which is located under Service Adapters into the
External ReIerences column in JDeveloper.
Training Tutorial: Oracle BAM - BPEL Sensors
(tutorial for bpel-bamsensors and bam adapter.doc)

tutorial Ior bpel-bamsensors and bam adapter.doc
Page 15 oI 26
June, 2009 (version 11.1.1.0.0)
Document version (2)
Oracle conIidential, All rights reserved

49.This will automatically open the conIiguration wizard Ior the BAM Adapter.
50.Give the service the name 'OrdersBAMAdapter and click 'Next.

51.Use the browse button to select the 'Orders data object under Training
End2End-105-POProcessing and click the 'OK button.

Training Tutorial: Oracle BAM - BPEL Sensors
(tutorial for bpel-bamsensors and bam adapter.doc)

tutorial Ior bpel-bamsensors and bam adapter.doc
Page 16 oI 26
June, 2009 (version 11.1.1.0.0)
Document version (2)
Oracle conIidential, All rights reserved
52.Change the 'Operation to 'Upsert, leave the deIault 'Operation Name
writetoBAM, and select 'OrderID as the key Ior the upsert operation. The
'Upsert operation will insert the row, iI doesn`t exist or it will update it based
upon the speciIied key.
53.Check the box 'Enable Batching. This will allow messages to be captured even
when the BAM server is not available. When the BAM server is available again,
messages that were generated while the server was down will be sent.

54.Click the 'Next button.
55.Change the JNDI name to 'eis/bam/rmi to use RMI to send messages to BAM.

56.On the Iinal step, click the 'Finish button.
Modifying the Mediator component
57.Drag a link Irom the 'Route PO Mediator component to the
'OrdersBAMAdapter that you just created. This will create a link between the
mediator and the BAM Adapter.
Training Tutorial: Oracle BAM - BPEL Sensors
(tutorial for bpel-bamsensors and bam adapter.doc)

tutorial Ior bpel-bamsensors and bam adapter.doc
Page 17 oI 26
June, 2009 (version 11.1.1.0.0)
Document version (2)
Oracle conIidential, All rights reserved


58.Double-click on the 'routePO mediator, to modiIy the conIiguration.
59.Find the 'OrdersBAMAdapter::writetoBAM operation and click on the icon next
to 'TransIorm Using. This will allow you to create a transIormation map.

60.Choose 'Create New Mapper File, accept the deIault name, and click 'OK.
Training Tutorial: Oracle BAM - BPEL Sensors
(tutorial for bpel-bamsensors and bam adapter.doc)

tutorial Ior bpel-bamsensors and bam adapter.doc
Page 18 oI 26
June, 2009 (version 11.1.1.0.0)
Document version (2)
Oracle conIidential, All rights reserved

61.This will open the mapper Iile. Drag Irom each Iield in the Purchase Order
request to the corresponding Iield in the OrdersBAMAdapter WSDL. Note that
you do not need to drag anything Ior the Total and ReceivedDate Iields. These
are either calculated or automatically populated Ior you in BAM.


62.When you are Iinished the mapping, choose 'Save All Irom the 'File menu to
save all Iiles that were created or modiIied.

Part5: Testing BAM Integration with the BAM Adapter
At this point, you can test using a mediator and a BAM Adapter to send messages to the
BAM server. Deploy your composite to the SOA server and use Enterprise Manager.
DepIoying the POProcessing Composite
63.Right-click on the POProcessing project and deploy it your server.
64.Make sure you check the 'Overwrite composites with the same ID, iI you choose
to use the same version number.

Running the appIication
Test the composite to see the results appear in the BAM data objects and in the
report.Once the application is deployed, you are ready to try running it.
65.Login to Enterprise Manager (http://localhost:7001/em) and select the version oI
the PO Processing component that you want to test.
Training Tutorial: Oracle BAM - BPEL Sensors
(tutorial for bpel-bamsensors and bam adapter.doc)

tutorial Ior bpel-bamsensors and bam adapter.doc
Page 19 oI 26
June, 2009 (version 11.1.1.0.0)
Document version (2)
Oracle conIidential, All rights reserved

66.Click on the 'Test button Ior that service.
67.Enter a small order by doing one oI the Iollowing:
68.Type the values into in to the HTML Iorm, or
69.Click XML View so you can paste in the XML payload. This is the recommended
way. Open the Iollowing Iile in a text editor:
70.c:\po\input\smallvalidCC.xml
71.Copy the entire contents and paste them into the large text Iield in your browser:

72.Click the 'Test Web Service button.
73.The Response tab won't have any response because this is a one-way invocation
with no reply or callback. But you should see that the Test Status: Passed.

74.Login to the BAM Architect and veriIy that the data was received in the data
object by selecting the Orders Data Object and the Contents link. This veriIies
that the adapter changes were made correctly and everything is working properly.
Training Tutorial: Oracle BAM - BPEL Sensors
(tutorial for bpel-bamsensors and bam adapter.doc)

tutorial Ior bpel-bamsensors and bam adapter.doc
Page 20 oI 26
June, 2009 (version 11.1.1.0.0)
Document version (2)
Oracle conIidential, All rights reserved

Part 6: Adding BAM Sensors to the BPEL Process
In this step, you add BPEL sensors to the existing BPEL process to detect changes in
status and update the BAM data object. The row was originally inserted by the call to the
BAM adapter Irom the mediator. This is another way that you can integrate Irom BPEL
to BAM.
Create VariabIe Activity Sensors
75.Open the BPEL Process by double-clicking on 'ApproveLargeOrder BPEL
process.
76.Double-click on the 'assignCCNumber activity to start to modiIy it.
77.Select the 'Copy Operation tab and click on the plus button to add a new copy
operation.
78.Use the expression Pending Approval` and map it to the status Iield oI the
'Order outputVariable.

79.Click 'OK.
Training Tutorial: Oracle BAM - BPEL Sensors
(tutorial for bpel-bamsensors and bam adapter.doc)

tutorial Ior bpel-bamsensors and bam adapter.doc
Page 21 oI 26
June, 2009 (version 11.1.1.0.0)
Document version (2)
Oracle conIidential, All rights reserved

80.Click on the 'Sensors tab to start the process oI adding a new sensor.
81.Use the plus button to create a new activity sensor.
82.Set the Name oI the sensor to 'PendingApprovalActivitySensor and set the
Evaluation Time to 'Completion.
83.Use the plus button in the Activity Variable Sensors box to add a variable.
84.Choose the outputVariable Order and click 'OK.

Training Tutorial: Oracle BAM - BPEL Sensors


(tutorial for bpel-bamsensors and bam adapter.doc)

tutorial Ior bpel-bamsensors and bam adapter.doc
Page 22 oI 26
June, 2009 (version 11.1.1.0.0)
Document version (2)
Oracle conIidential, All rights reserved
85.Click 'OK to close the output variable screen.

86.Click 'OK to create the activity sensor.

87.There is no sensor action assigned to this activity sensor yet. With the
'approveLargeOrder BPEL process open, navigate to the 'Sensor Actions
Iolder in the Structure panel.
88.Right-click on Sensor Actions and select Create ~ BAM Sensor Action.


Training Tutorial: Oracle BAM - BPEL Sensors
(tutorial for bpel-bamsensors and bam adapter.doc)

tutorial Ior bpel-bamsensors and bam adapter.doc
Page 23 oI 26
June, 2009 (version 11.1.1.0.0)
Document version (2)
Oracle conIidential, All rights reserved
89.The 'Create Sensor Action screen will appear.
a. Enter the name 'PendingApprovalSensorAction,
b. Choose the 'Pending Approval Sensor Action,
c. Use the magniIying glass next to Data Object to select the 'Orders data
object,
d. Select 'Upsert as the BAM Operation,
e. Select OrderID as the key,
I. ModiIy the name oI the map Iile to:
'bam\xsl\PendingApprovalSensorAction.xsl
g. Change the JNDI setting to: 'eis/bam/rmi Ior the BAM Connection
Factory JNDI.
h. Keep the Enable Batching box checked.
i. Use the plus symbol, next to Map File to create a new mapping Iile.


i. Create links Irom the Iields on the Source side under
tns:actionData ~ tns:payload ~ tns:variableData ~ tns:Data ~
sensor:Order to the corresponding Iields on the Target side in
tns:Orders1.
Training Tutorial: Oracle BAM - BPEL Sensors
(tutorial for bpel-bamsensors and bam adapter.doc)

tutorial Ior bpel-bamsensors and bam adapter.doc
Page 24 oI 26
June, 2009 (version 11.1.1.0.0)
Document version (2)
Oracle conIidential, All rights reserved


90.By Iollowing the same process that you used to create a
'PendingApprovalActivitySensor and a 'PendingApprovalSensorAction, create
a 'CallbackActivitySensor and a 'CallbackSensorAction. Add this sensor to the
'callbackClient activity at the end oI the process. This time set the Evaluation
Time to 'Activation. Make sure you add the activity variable and perIorm the
mapping. Remember you can only create a BAM Sensor Action Irom the
structure panel while the BPEL process is open.

Training Tutorial: Oracle BAM - BPEL Sensors
(tutorial for bpel-bamsensors and bam adapter.doc)

tutorial Ior bpel-bamsensors and bam adapter.doc
Page 25 oI 26
June, 2009 (version 11.1.1.0.0)
Document version (2)
Oracle conIidential, All rights reserved

91.When you are done, you can go back to the 'Sensors tab oI the activity. Double-
click on the sensor that you want to edit (or use the pencil icon) and you will see
the 'CallbackSensorAction associated with the 'CallbackActivitySensor.

DepIoying and Running the Composite
In lhis sle, you re-deIoy lhe nev comosile in }DeveIoer and lesl il again using lhe
Inlerrise Manager lesling funclion. This lime use a Iarge order.
Create VariabIe Activity Sensors
92.Open the BPEL Process by double-clicking
93.In JDeveloper, re-deploy the composite with a new version ID.
94.In Enterprise Manager 'Fusion Middleware Control, click on the composite with
the version number that you just deployed.
Training Tutorial: Oracle BAM - BPEL Sensors
(tutorial for bpel-bamsensors and bam adapter.doc)

tutorial Ior bpel-bamsensors and bam adapter.doc
Page 26 oI 26
June, 2009 (version 11.1.1.0.0)
Document version (2)
Oracle conIidential, All rights reserved
95.Click on the 'Request tab to try the test again with a large order that has an
invalid credit card. Notice that the status is updated in the BAM. Use the data Iile
c:\po\input\largeinvalidCC.xml

96.Test again with a large purchase order over $5000 with a valid credit card. Check
that the status oI that purchase order in BAM is 'Pending Approval.
97.Use the BPM Worklist application to approve the order. Notice that the status is
updated to 'approved.
98.Open the report using 'Active Viewer to see the data. It will update in real-time
as new purchase orders are received.

Summary:
At the end oI these exercises the participants understand how to:
Create a Data Object and a BAM Dashboard.
Create a BAM Adapter.
ConIigure BAM Sensors and Sensor Actions

Questions & Clarifications:
II you have any comments or need additional inIormation, please communicate through
the Oracle BAM Iorum at: http://Iorums.oracle.com/Iorums/Iorum.jspa?IorumID252

Вам также может понравиться