Showing posts with label Task. Show all posts
Showing posts with label Task. Show all posts

Friday 24 February 2017

Human Task Implementation in Oracle SOA Suite - Part 2


This post is in continuation of my Part 1 of Human task implementation. You can read part 1 at below url :




So there are mainly 2 ways we can deploy Human task related artifacts to Application server.

1. Directly Deploying from Jdevloper.
2. Exporting project from Jdevloper, and Using EM console & Weblogic Console to deploy to Application server.


First, we will go with Directly Deploying from Jdevloper.

Now deploy the project along with the UI application created from Human task definition.
While deploying we will wizard as below where we need to specify the UI application info. Select the check boxes as below.

This is the only difference which we will be getting when compared with deploying SOA project without Human task








Second Approach, Exporting project from Jdevloper, and Using EM console & Weblogic Console to deploy to Application server.


1. Deploy your Human Task FORM UI as EAR file to local directory. PFA screens below. 
Please Note - Deploying it by Right Click on Project name will not create a EAR file, It will create a WAR file, which will give error while deploying.






2. Deploy your Human Task FORM UI as EAR file ( Generated in STEP 1) to Weblogic Console. PFA screens below.

Login to Weblogic console, Go to Deployments, Take Lock & Edit, Click on Install


Click on Upload your file in 12c servers (You need manually upload your file to server loaction in 11g Servers.)



Choose location, select UI EAR file



Once Uploaded, You will see this screen, Click on NEXT



Leave everything Default, Click on Next,



Select SOA manage Server



Leave everything Default, Click on Next


Leave everything Default, Click on FINISH


Activate The chnages,




Now, you need to Start the UI application deployed in previous step.
Go to Deployments, Select Control Tab



Select your UI Appliaction



Select Start--> Sevicing all request




Select YES to start.





3. Deploy your SOA Composite Project to JAR file on local directory. PFA screens below.





Do not select anything here, keep everything unselected,






4. Deploy your SOA Composite JAR file from local directory to EM Console. PFA screens below

Login to EM Console, Go to SOA-INFRA, Deploy composite


Select your Composite JAR file



Click Next


Review your Deployment,Click Next



Click on Deploy




Unit Testing

Go to deployed application and test it by giving the below details.





Click on the “Launch Flow Trace” to see the execution of the process.

You can notice that process is still running. This is because we have human activity as part of the process where human have take a action on the order


So Now logon to the worklist application using the below url


Login as user given in the Human task definition. Once you are logged in you can notice there list of request pending for logged-in user


Click on the request item. The details of the item will be displayed. Based on the outcome specified in the human task definition, it will creates the button for the human to take an action


Click “Reject” or “Approve”. Here will select “Approve”. Once human performs an action the item will be displayed from the list


Now go back to your process instance. You can notice that the process would be completed the execution


Here we are using browser as client to we can’t view the response data. But we can view what data the process has returned by clicking the process

You can notice that “Approve” case from the switch activity was executed because user has “Approved” the order request.

Based on the outcome we are returning “Approve” as the order status to the client as callback response




Human Task Implementation In Oracle SOA Suite - Part 1



A human task is, quite simply, a unit of work that involves a human. Quite often, this task requires that the human interact with other services, and thus becomes a task within a larger business goal.
Human task provide the feature where human person can interact with the business process to take business decision.
For modeling the process containing the human task we need to do following:
1.   Creating and modeling a human task definition using Human task component (Also known as Human task service)
2.   Generating the task form for displaying the human task during runtime in Oracle BPM Worklist.
3.   Associating it with a BPEL process
Use case: Let’s take a use case from Order Management System, where the order process requires the approval from the manager.
Implementation

Create a SOA project with name “HumanTaskProject” having empty composite



Create a Asynchronous BPEL process by dragging the bpel component on the composite.
Since we are going to have a Human task within the bpel process and we can’t expect the response with in a timeline from human task.

So to avoid process timeout we will be creating the asynchronous process.



IDE will create the wsdl, xsd required for the process. So modify the files as for our requirements below
Generated XSD


Modified XSD



Generated WSDL



Modified WSDL


Now your composite looks like below 


 Before adding the Human Task to BPEL OrderProcess, we should creating Human Task definition which will act as partner link and also to generate the web application using which human can interact with the process.
In Human task definition, we can specify human task metadata such as task outcome, payload structure, assignment and routing policy, expiration and escalation policy, notification settings.
Create a Human Task definition by adding Human Task component to the composite. Here we are not adding Human task in to the bpel process.


 Enter Name as “OrderProcessHumanTaskDefinition” or of your choice and click OK


And Now your composite look like below 

Double click the “OrderProcessHumanTaskDefinition” and you will get below wizard

Specify the Task Title by clicking the Build Title editor highlighted in the above and Click OK

Select the outcomes from the Human Task by clicking the browse button. Here we are specifying the possible values that can be return from the human task when human has acted on the request.
Click OK after you select the required values. If you require any other values apart from this click “+” and add them.
For this example we require only Approve and Reject. So I am selecting the both

Now click on the “Data” tab

Now specify the input data format by clicking the “+” and selecting “Add other parameters” if we are sending the xml data. Otherwise we can select either string, int etc.

We will be sending the xml data so I will be selecting the Add other parameters.

Browse the XSD element

Select the order request element and click OK.

Again Click OK in Add Task Parameter wizard

Now click on the “Assignment” tab to add the participant/user who can access this request or act on the request

Click on the “Edit Participant” and you will be getting the below wizard.

Click “+” and select “Add User”.

You can select the user from weblogic server by clicking browse button or if you Now the user name you can direct enter the user name.

Click OK

Now generate the UI application from where human can act by clicking the “Create Form” and select “Auto generate Task form”.

You will get a wizard to create a project. Enter the name as “OrderProcessUI” and click OK.
Now wait from some time. A ADF web project will be created and you can see lot of files will be created automatically, opened in the editor.
Click Save All and close the other files which are opened automatically.

Now go back to your SOA project and open your composite.xml

Now connect the “OrderProcess” with “OrderProcessHumanTaskDefinition” as below

Double click “OrderProcess” or open the bpel OrderProcess to do the process orchestration

Now add the human task component by dragging and drop the human task component on to the bpel process

Open the new add human task component by double clicking it

Select the task definition which we have created earlier. When we select task definition we will be asked specify the details configured in task definition

Now select the bpel variable which has the data to be passed to human task by clicking the browse button

Select the “orderRequest” and click OK.

Then in Human Task wizard click Apply and OK. When we click “OK”, IDE will automatically create a switch activity with possible conditions based on the outcome of Human task definition

Delete the otherwise case in switch activity. Since I don’t want to deal with default cases.
Now expand the human task activity. When we selected the human task definition, IDE will automatically creates “Assign”, Invoke and Receive activities.

Assign activity will copy data from variable of Receive activity to variable which is part of the invoke activity.

If the invoke and receive activity are not connected to Task service which is created from the human task definition then we need to connect them explicitly.

When we connect them we will get the edit wizard. Just click “Apply” and then OK

Click on the condition of Switch activity. We can notice the condition is created based on the outcome from the human task. Nothing to modify here

You can also notice that there are assign activities in sequences of each case in the switch activity.

By default assign activity will copy the payload received from the human task to input variable

Delete this by clicking delete button highlighted above.

We are doing this because I need to send the action performed by human as the response to the client in the callback.

Scroll down the “SystemAttributes” which is part of “task”. Here we will be having “outcome”. Copy the outcome to output variable as below

Click Apply and OK.

Repeat the same for assign activity in another case as well.
This was the developement part, we have completed it. Now we need to Deploy the Application and do the Unit Testing.
Follow my Part 2 of the Deployment and Unit testing.