Tutorial: Designing a
Purchase Order
Processing System by
Using AquaLogic
Integrator
Actionable Exception Management
This chapter describes the use of worklist for enabling actionable exception management. This chapter explains how to modify the PurchaseOrderFulfillmentJPD to create a worklist task in case of any exception. You will be reusing the worklist artifacts from the downloaded application {TUTORIAL_ROOT}.
This section describes how to enable the worklist project facets to the EAR and Webapp projects.
To Enable Worklist Facets
Select the EAR folder (UseCase) from Package Explorer.
Right-click on the UseCase folder, select Properties.
In the Properties for UseCase dialog box, select Project Facets.
Click Add/Remove Project Facets....
Select AquaLogic Core Facet, and WebLogic Integration Worklist Application Module.
Similarly, right-click UseCaseWeb, and select Properties.
In the Properties for UseCaseWeb dialog box, click Add/Remove Project Facets.... Select Beehive Controls, Struts, and WebLogic Integration Worklist Application Module.
Copying Files Required to Enable Actionable Exception Management
Copy the following files into your workspace:
Copy PublishError.java from <TUTORIAL_ROOT>\ALIntE2EUsecase\UsecaseApp\UseCaseWeb\src\alint\process \helperinto the src\alint.process.helper folder.
Copy PublishErrorServiceBrokerControl.java from <TUTORIAL_ROOT>\ALIntE2EUsecase\UsecaseApp\UseCaseWeb\src\alint\process into the src\alint.process folder.
Copy the following files:
CreatePOErrorHandlingTask.java
CreatePOErrorHandlingTaskService.wsdl
CreatePOErrorHandlingTaskServiceControl.java
from <TUTORIAL_ROOT>\ALIntE2EUsecase\UsecaseApp\UseCaseWeb\src\alint\errorhandling\ws into src\alint.errorhandler folder.
Importing Worklist Projects
This section describes how to import Worklist projects into the workspace, in which you are building your Purchase Order Application.
From the BEA WorkSpace Studio menu, click File > Import > General > Existing Projects into Workspace. The Import dialog box is displayed.
In the Import Projects dialog box, browse to the directory <TUTORIAL_ROOT>/ALIntE2EUsecase/UsecaseApp where the tutorial sample application is installed. Select the following files from Project pane:
Callback Handler
UsecaseEH
UsecaseEHWeb
These files are now displayed in Package Explorer.
From Package Explorer, right-click on Callback Handler, and select Properties.
In the Properties for Callback Handler window, select ALSB Configuration. In the ALSB Configuration pane, select ServiceAccessConfiguration, and click Apply.
The Worklist - related files are imported to the workspace.
Modifying PurchaseOrderFulfillmentJPD for Exception Handling
In Package Explorer, go to src > alint.process > PurchaseOrderFulfillmentJPD.java.
Drag and drop the ErrorInfoPublishControl.java into Data Palette.
Right-click on the PurchaseOrderFulfillmentJPD in the Design view, and select Add Exception Path to create an Exception Path.
From the Data Palette > Controls > publishErrorServiceBrokerControl, drag and drop the voidpublishError methodinto the onException path. Right click and select View Code.
Copy the following code and paste it into the Source view.
public void publishErrorServiceBrokerControlPublishError() throws Exception {
Expand the errorInfoSubscriptionControl.java from the Data Palette > Controls folder.
Drag and drop the void subsrcibeWithFilterValue, after the ccTxInfoSbscrptnn node in the Design view.
Double click on this node. In the Send Data tab, select order Id from Select variables to assign drop-down list.
Drag and drop a Parallel node from the Node Palette. The PurchaseOrderAggregatorJPD is now updated as shown in Figure 9-1.
Figure 9-1 Parallel Nodes to the JPD
Drag and drop the Parallel node, accessService node, and the archiveOrder node under the first Branch on this newly created Parallel node. The updated JPD is as shown in Figure 9-4.
Figure 9-2 Updated POAggregatorJPD
From the Data Palette > Controls > errorInfoSubscriptionControl, drag and drop void onMessage method to the empty parallel branch.
Double click onMessage. In the Receive Data tab, select create a new variable from create variables to assign drop-down list.
In the Create Variable dialog box, enter errorMessage as the Variable Name. Click OK.
Click Close.
Drag and drop a Perform node from the Node Palette under this onMessage node.
Rename node to moveFileToError.
Right-click on this node, and select View Code. Add the following code:
File orderFile = new File("C:/ALIntApp/PurchaseOrder/New/PO-" + orderId + ".xml");
You have now created a worklist task using a webservice wrapper.
Modifying the PurchaseOrderProcessingServiceProxy to Save the Incoming Messages for Future Reference
To Modify the PurchaseOrderProcessing Proxy
Open the message flow for PurchaseOrderProcessingProxy.
Drag and drop a publish node, so that it is the first node in the pipe line you have already created.
Note:
The pipeline has already been configured to publish to PurchaseOrderAggregatorJPD and PurchaseOrderFulfillmentJPD. The new publish node you are adding will be before these two.
Drag and drop Stage Actions > Transport Headers into the Publish node.
In the Transport Header Properties pane, ensure Direction is Outbound Request.
Click on Add Header.
Select file and filename from drop down lists in the Name pane.
For the expression, Set Header To give the following value:
You have now modified the proxy message flow to save the incoming purchase order to your file system for future reference. The modified proxy, with the transport header is shown in
Figure 9-4 Modified PO Processing Proxy
Providing Anonymous Access to Task Plan
The ReprocessPOHandlerJPD.java located at UsecaseApp\UsecaseEHWeb\src\alint\errorhandling needs to access task data and reprocess the Purchase Order.
To Provide Anonymous Access
Log on to Worklist Console: http://localhost7001/worklistconsole.
For example, you can provide User Name/ Password as weblogic/weblogic.
From the Worklist System Instance, expand UsecaseEH.
Click /task_plans/POExceptionHandlingTaskPlan.
Click Edit in Task Plan Policies pane.
From the Task Plan Policies pane, select add Admin, and Anonymous roles to the Selected Roles column from the Available Roles for Admin, Update, Create, and Query as shown in Figure 9-5.
Figure 9-5 Selecting Roles
Click Submit.
The Task Plan policies get updated.
Testing Actionable Exception Management
After you have published the sample application, enter invalid data in the sample application browser. For example in the Soap body of the TestClient, provide a wrong PurchaseOrder ID. To verify actionable exception management, log on to the Worklist User Portal, and reprocess the error. Also, for more information about testing the sample application, see Testing the Application.
The following steps in this section describes how to verify Actionable Exception Management:
In the next steps, you can correct the values in the Worklist User Portal and reprocess the order, without any exceptions, after modifying the .xml file that is now created in the ALIntApp\Purchase Order\Error folder. See Creating the Tutorial Environment, for creating these folders.
To Modify the .XML File
Select the PO-POMarch11.xml that is created in ALIntApp\Purchase Order\Error folder.
Edit the ItemId in PO-POMarch11.xml file by providing the following values, by entering the IdemId as 1.
Save the PO-POMarch11.xml file.
To Reprocess the Order in Worklist User Portal
Logon to http://localhost:7001/UsecaseEHWeb/user.portal.
Click Show all tasks in this view from the Upcoming Tasks pane.
Click PurchaseOrder-POMarch11 from Task Name column.
The Task Work window is displayed.
Click Work.
In the next screen, click Reprocess Purchase Order, under Actions pane. Click Next.
Enter the desired values for Reviewer Comments, ReviewerContact, ReviewedBy, as shown in Figure 9-8.
Figure 9-8 Reprocessing Purchase Order
Click Submit.
The Purchase Order is reprocessed with the correct values, and the transactions are displayed on the WLS console as shown in Figure 9-9.
Figure 9-9 Transaction Completed Message on WLS Console
In the http://localhost:7001/UseCaseWeb/alint/client/test/TestClient.jpd browser, click Refresh.
The callback message is displayed as shown in Figure 9-9.