Oracle® SOA Suite 10.1.

3 Hands-On Workshop BPEL and ESB
CREATE THE PERMIT APPLICATION BPEL PROCESS................................ 2 Create JDeveloper BPEL Project............................................................................... 2 Import XSD Files ........................................................................................................ 4 Assign the BPEL Instance/Reference ID..................................................................... 9 Add Background Check............................................................................................. 19 Add ESB Data Service .............................................................................................. 29

Create the Permit Application BPEL Process
This lab will build out the BPEL process to handle permit application requests. This process will utilize the ESB BackgroundCheckSOAP and ESB PermitDBOut services.

Create a BPEL Project
1. First a JDeveloper BPEL project needs to be created. Right-click on the SOAWorkshop application workspace and select “New project…”

Figure 1

2. In the New Gallery window, select BPEL Process Project and click the OK button.

Figure 2

3. Name the new BPEL process “PermitProcess” (no spaces in the name). Make sure the Template “Synchronous BPEL Process” is selected. Click Finish.

Figure 3

4. JDeveloper should now show an empty BPEL process as shown in the following diagram.

Figure 4

Import XSD Files
5. Next, we will import XML Schemas (XSD) that include object definitions for our Permit Application. The XSD includes definitions for the Permit Application which will be defined as the input to the BPEL process. The XSD also includes a response object that will be configured. Select the Schemas folder in the Structane pane located at the lower-left corner of JDeveloper. Then right-click.to select the Import Schema… option.

Figure 5

6. In the Import Schema window, click the flashlight icon.

Figure 6

Select the PermitApplicationCanonical.xsd in the Structure pane. Click Open and then OK. You should see the PermitApplicationCanonical. Now the definitions of the PermitApplicationCanonical. Figure 7 8.xsd file in the /home/oracle/MyFiles/support directory.xsd file can be referenced in the BPEL process.7. Figure 8 .

In the Structure pane expand the tree for Message Types > Process WSDL as show below. Figure 10 . select the flashlight icon. these structures are defined as simple string types.9. By default when a BPEL process is created.xsd schema. Select the payload element for PermitProcessRequestMessage and select the “edit” pencil icon. the inbound request object and the response object for the BPEL process needs to be assigned to structures defined in the PermitApplicationCanonical. Next. In the Edit Message Part window. Figure 9 10.

11.xsd path. In the Type Chooser dialog select the PermitApplication element under the Project Schema Files PermitApplicationCanonical. select the payload element under the PermitProcessResponseMessage and select the pencil icon. the XSD structure for the BPEL response will be defined. Figure 11 12. Click OK twice. Figure 12 . In the Structure pane of JDeveloper. Next.

. In the Edit Message Part window.13. Click OK twice. Figure 14 15. Figure 13 14.xsd path. select the flashlight icon. In the Type Chooser dialog select the PermitApplicationResponse element under the Project Schema Files PermitApplicationCanonical. Save your work by selecting the Save All icon on the Toolbar.

Figure 16 . Create an assignment in the BPEL process to place values into the BPEL response object. Figure 15 17. In the BPEL flow drag an Assign activity from Components Process Activities and drop it below the receiveInput activity. Your BPEL process should look like the following. Double-click on the Assign_1 activity.Assign the BPEL Instance/Reference ID 16.

Figure 18 . Click on the General tab and specify the name as AssignPermitIDAndReply. Select the Copy Operation… from the pop-up list. Click on the Copy Operation tab and click the Create option.18. Figure 17 19.

Figure 20 . In the Expression Builder window select the BPEL Xpath Extension Functions from the Functions list. Select the getInstanceId function and click the Insert Into Expression button. Click OK. Select the icon.20. Figure 19 21. In the Create Copy Operation dialog select the Expression “Type:” in the From portion of the window (left side).

In the Assign window. Click OK. select the Copy Operation… again. a copy operation will be defined for the StatusCode element in the response. Next.22. For this simple scenario we’ll just assign a value of “0”. Figure 22 . Figure 21 23. In the To section of the Create Copy Operation window make sure the Variable “Type:” is chosen and then select the Variables Process Variables outputVariable payload ns1:PermitApplicationResponse ns1:ReferenceID element.

Create another copy operation following steps 20 and 21. select StatusCode node as indicated in the diagram below. Click OK. For the To Variable. Click OK.24. Figure 23 25. In the Create Copy Operation window select Expression “Type:” for the From variable. The last copy operation will assign the BPEL instance id to the PermitID variable defined in the PermitApplication structure. Enter ‘0’ as the expression string as indicated below. Figure 24 . This time map the value to Variables Process Variables inputVariable payload ns1:PermitApplication ns1:PermitID.

Compile the BPEL process to make sure there are no errors. Click OK.26. Figure 25 27. Your Assign activity should now have the following 3 copy operations. you should see a message like the following “Successful compilation: 0 errors. Figure 26 . This will compile the BPEL process and you can look at the log window for any errors. If the BPEL process was built correctly. Click the Rebuild icon in the top center of the JDeveloper screen. 0 warnings”.

In the JDeveloper Applications window right-click on the SOAWorkshop PermitProcess project and select Deploy Local_IntegrationServer Deploy to default domain. (For first time deployment this will not display).28. The BPEL process will now be deployed to the application server to validate that it runs correctly with the current logic defined.0 for this lab. Figure 27 If the “Deployment Properties” window pops-up just select the OK button. The BPEL process will now be deployed to the application server. Figure 28 . We will ALWAYS deploy Version 1.

Double click on the Desktop Icon or go to the following URL: http://localhost:8888/BPELConsole (This URL is already in the browser “Links” bar) You will be prompted for a username and password.If deployment ran successfully. Figure 30 . you should see in the Apache Ant – Log window a message like the following indicating “BUILD SUCCESSFUL”. Log on to the BPEL Control window to test the process. Figure 29 29. Enter “oc4jadmin” and “welcome1” respectively.

You should now be presented with the “Initiating a test instance” page. Click on the PermitProcess link in the “Deployed BPEL Processes” column. You don’t need to specify values for PermitID and WorkflowID as they are assigned in the actual BPEL process. Click the Post XML Message button to invoke the process. The PermitProcess process should be shown in the left hand list of BPEL processes under “Deployed BPEL Processes”. Figure 31 31.30. . Enter some values for some of the parameters like below.

270001 is only an example. Figure 32 We can see by selecting the Instances tab of the BPEL Console that 270001 is the value of the BPEL instance id. This value will vary based on the current Instance ID in the BPEL system.32.(Notice that the StatusCode has a value of 0 (which we specified in the assign activity) and the ReferenceID has value of 270001 (which should be the BPEL instance ID)). This shows the reply from the BPEL process. Figure 33 . Your ReferenceID will vary. After submitting the sample data you should see output similar to the following.

Back in JDeveloper a background check service will be added to the BPEL process flow. From the popup window.Add Background Check 33. Now click on the Service Explorer (flash light icon) to locate the BackgroundCheckSOAP Service we defined in the previous ESB lab: Figure 35 . In the “Create Partner Link” dialog specify BackgroundCheckService (no spaces) as the partner link name. select Create Partner Link… Figure 34 34. Right-click in the Services swimlane on ether side of the canvas.

Figure 37 .In the Service Explorer dialog navigate down through Registered ESB Services Local_IntegrationServer PermitData and select BackgroundCheckSOAP. Click OK. Click OK. Figure 36 Configure your “Partner Role” as indicated in the following diagram.

Next. Figure 39 . The Edit Invoke dialog pop-up appears. Figure 38 36. Drag an Invoke activity from the Components Process Activities to the BPEL canvas and place it below the replyOutput activity. Click on the arrow icon to the right of the Invoke_1 activity and drag it on top of the BackgroundCheckService.35. an Invoke activity will be added to the BPEL process to invoke the BackgroundCheckService.

Figure 41 39. click on the magic wand icon to the right of the “Input Variable:” field. Click OK. The Create Variable pop-up dialog should appear. Next. Figure 40 38. Click on the magic wand icon to the right of the “Output Variable:” field. Specify the name of this activity as InvokeBackgroundCheckService. Click OK. This window automatically creates a BPEL variable that we will use to pass data to the background check service.37. This creates a BPEL variable for storing the reply from the background check service. . Accept the default variable name.

Figure 42 Click the Green Checkmark on the Canvas Toolbar.40. . Click OK. The Edit Invoke dialog should now look like the following. This validates the process.

Drag an Assign activity above InvokeBackgroundCheckService. Figure 44 . Figure 43 42. Notice the yellow flag next to the “InvokeBackgroundCheckService” activity. The BPEL process should now look like the following.41. This flag exists because we have not yet assigned values to the BPEL variables used in invoking the background service.

Click the Create option and select Copy Operation… from the pop-up list. Figure 46 . Figure 45 44. Double-click on the assign activity and click the General tab.43. Click on the Copy Operation tab. Specify a name of AssignBackgroundCheck.

45. For the To Variable select the Variables Process Variables InvokeBackgroundCheckService_checkApplicant_InputVariable payload ns1:Applicant node. Click OK twice. Figure 47 . The Create Copy Operation window appears. For the From Variable select the Variables Process Variables inputVariable payload ns1:PermitApplication ns1:Applicant node.

. Figure 48 47.46. From the Components Process Activities list drag an Assign activity to below the InvokeBackgroundCheckService activity. Click on the General tab and enter AssignBackgroundCheckReply in the “Name:” field. Double click the Assign_1 activity. Add an Assign activity after the InvokeBackgroundCheckService to handle the reply message from the background check service.

Create a copy operation as indicated in the following diagram. The From variable is Variables Process Variables InvokeBackgroundCheckService_checkApplicant_OutputVariable ns3:BackgroundCheck ns3:Status. payload payload Figure 49 Click OK. Click on the Copy Operation tab. The To variable is Variables Process Variables ns1:PermitApplication ns1:BackgroundCheck inputVariable ns1:Status. .48.

The From variable is Variables Process Variables InvokeBackgroundCheckService_checkApplicant_OutputVariable ns3:BackgroundCheck ns3:FailureReason. Create a second copy operation like the following. The To variable is Variables Process Variables ns1:PermitApplication ns1:BackgroundCheck payload inputVariable payload ns1:FailureReason. Figure 50 Click OK twice.49. .

Figure 52 . Name the partner link PermitDataService. Now we’ll add logic to the BPEL process to invoke the ESB data service. Click on the flashlight icon to select a service.Add an ESB Data Service 50. Figure 51 51. Right-click on ether of the two Services swimlanes and select Create Partner Link.

In the Service Explorer dialog select the Registered ESB Services Local_IntegrationServer PermitData PermitData_RS node. Figure 54 . Click OK. In the Create Partner Link window make sure the entry for Partner Role is as indicated in the diagram below.52. Click OK. Figure 53 53.

Drag an Invoke activity to the BPEL canvas below the AssignBackgroundCheckReply activity. Drag the arrow icon on the right side of the Invoke activity and drop it onto the PermitDataService. Figure 55 55. Figure 56 .54.

Click the magic wand icon to the right of the “Input Variable:” text field. Figure 57 57. In the General tab name the Invoke activity InvokePermitDataService. Since this is a one-way operation you will only need to define a BPEL variable for the Input variable. Figure 58 .56. In the Edit Invoke window click OK. Name the variable InvokePermitDataServiceInput and click OK.

Drag an Assign activity above the InvokePermitDataService. .58. Figure 59 59. Double click the Assign_1 activity. Select the General tab and specify the name as AssignPermitDataService.

Figure 60 Click OK twice. Drag and drop a Switch activity from the Components below the AssignPermitDataService Assign activity. Variables inputVariable The To variable is Variables Process Variables InvokePermitDataServiceInput > PermitApplication > ns1:PermitApplication.60. The From variable is Variables Process payload ns1:PermitApplication. Create a copy operation as defined in the following diagram. 61. Process Activities palette Figure 61 . Select the Copy Operation tab.

62. Figure 62 63. When the Condition Expression dialog comes up click the green checkmark icon again to bring up the Expression Builder. Expand the Switch via the “+” and click on the green checkmark icon to create the condition for the “case” process flow. Figure 63 .

Your completed expression should look like: Figure 64 Click OK and then click anywhere in the BPEL diagram to close the small expression window. 65.64. Click the “Insert into Expression” button and add = ‘Pass’ to the end of the expression. Drag and drop an Assign activity into the <case> flow Figure 65 . Navigate in the “BPEL Variables” pane to the InvokeBackgroundCheckService_checkApplicant_OutputVariable payload ns3:BackgroundCheck ns3:Status element.

On the From side select an Expression for the “Type:” and type ‘APPROVE’ as the expression source. Figure 66 Click OK twice. Double click on the Assign and name the activity APPROVE_REJECT via the “General” tab. .66. The select the “Copy” tab and click on Create Copy Operation. On the To side select Variables Process Variables InvokePermitDataServiceInput PermitApplication ns1:PermitApplication ns1:Approval ns1:Outcome as the target.

Figure 66 Deploy the BPEL process. Drag and drop an Empty activity into the <otherwise> flow.67. In the JDeveloper Applications window right-click on the BPEL project and select Deploy > Local_IntegrationServer > Deploy to default domain. Figure 67 .

Figure 68 . We will ALWAYS deploy Version 1.When the “Deployment Properties” window pops-up just select the OK button.0 for this lab. (For first time deployment this will not display).

Click on the Click here to apply for permit link.E) Test the Entire Flow Select Permit Application from the browser Fast Links Menu and “Open in a new tab” or go to http://localhost:8888/PermitDemoUI/faces/main.jsp. This is the first screen of the JSP application. .

In the next screen. fill out data like the example below. Select the Submit button. A confirmation screen will be shown. . Select the Confirm button if you would like to submit the data to BPEL else select the Edit button to edit your data.

Notice the reference number indicated in the message (in this example the reference number is 270002. This is the BPEL process instance id that was returned from BPEL. Got to the BPEL Console http://localhost:8888/BPELConsole. Log in as: oc4jadmin/welcome1 if required. You see that the top instance is completed.If you confirmed the data. Click on the Instances tab. you should get a screen like the following. yours will vary). .

Finally. Select the Data tab at the bottom of the table view. Open up the Database soademo soademo Tables folder.Now. Notice the new rows that have been added. The ESB instance ID is the same as the BPEL instance id. Select the Connections Navigator tab. . in the ESB Console (http://localhost:8888/esb/ select the Instances Icon (looks like a notepad) and you will see a new ESB flow instance was created (you can click on the green Go icon in the Search section to refresh). you can use JDeveloper to examine the database tables to see the new information that has been added. Double-click on either the APPLICANTS or PERMITS table.

This is the first screen of the JSP application. specify a social security number that starts with “9”). Click on the Click here to apply for permit link. .Now we’ll enter data that will force the BackgroundCheck to Fail and consequently no JMS message will be sent from the ESB service (i.jsp.e. Open a browser to http://localhost:8888/PermitDemoUI/faces/main.

. Select the Submit button. fill out data like the following.In the next screen. Notice the “9” leading the SSN.

The Filter Rule criteria was NOT met since the outcome was not APPROVE. You will now see that a new BPEL instance has run and is complete. Finally. .Go back to the BPEL Console. using the ESB Console notice that during this “run” the JMS destination was not invoked.

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master Your Semester with a Special Offer from Scribd & The New York Times

Cancel anytime.