Human Tasks is a specification which helps us define tasks performed by human beings. From an SOA point of view, we can view a Human Task as a service implemented by a human being.
WSO2 Business process server (WSO2 BPS ) 3.0.0 version includes an evolving initial implementation of a Human Task Engine. It provides the basic human tasks functionality such as the ability to define human tasks and notifications, timer events and escalations, and the people assignments.
Also within its implementation, WSO2 BPS provides its own task UI. However, as this task UI is included within the Administrative console of the server, we do not encourage one to use it. Instead, what we expect from a serious human tasks user is to build his own task ui using what ever the user interface implementation methodology that is used within the organization. This could be done using technologies such as JSP, PHP ect. As long as you have a way of sending out soap messages, you can build your own task ui. In the following section, I will describe how to build your own task UI.
In order to implement your own task UI, you need to understand how the Human task engine works.
A human task package will include at least one WSDL file which defines the ‘task service’ which is the service implemented by human being. In order to create a task, this task service should be invoked by an external party. This external party can either be an external web service invoker or a bpel process using Bpel4People extension activity. When a task instance is created, it will have its own unique task id which will be returned to the task invoker. Additionally, this task id can be obtained by using the simpleQuery operation which returns a list of tasks. When your perform operations on the task, this unique task id is used to identify the specific task instance among the many task instances residing within the task engine.
Human Task specification describes the human tasks client api in detail in Chapter 7 Programming interfaces. [1] http://docs.oasis-open.org/bpel4people/ws-humantask-1.1-spec-cs-01.html
WSO2 BPS human tasks implementation also implements the same API. In order to successfully call this task client api, first we need to find out the admin service interface for it.
Step1.
Go to carbon.xml located in <BPS_HOME>/repository/conf/ directory.
Change the setting <HideAdminServiceWSDLs>true</HideAdminServiceWSDLs> to false.
<HideAdminServiceWSDLs>false</HideAdminServiceWSDLs>
Now start the bps server with option –DosgiConsole.
Once the server is fully started, enter to go to osgi console.
Now type listAdminServices in osgi console.
osgi> listAdminServices
This will list down all admin services.
Our interested endpoint is
HumanTaskClientAPIAdmin,https://<ip>:9443/services/HumanTaskClientAPIAdmin/
Usually, when you try ?wsdl on this endpoint, the wsdl will appear. However, there is an issue with the HumanTaskClientApi WSDL. Hence please download the wsdls from following location. http://people.wso2.com/~nandika/htwsdl/
Step2.
Create a soap ui project from the human_task_api.wsdl. Your soap ui project will show the task operations available as following.
Now, we can use this soapui client to query the human task client api to obtain the necessary information about tasks. By this method, we can explore the available operations to build our own custom ui.
However, this service is an authenticated service. Therefore, first you need to obtain the session cookie returned by the authentication admin login request and set it as an http header in the soap ui. Please refer to my previous blog on how to set the session cookie.
Step 3.
Do the authentication admin login request and copy the returned session cookie.
Using the session cookie, send the simple query request with Filter ALL_TASKS to obtain a list of all tasks.
Use the following soap message for that.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://docs.oasis-open.org/ns/bpel4people/ws-humantask/api/200803" xmlns:ns1="http://docs.oasis-open.org/ns/bpel4people/ws-humantask/types/200803">
<soapenv:Header/>
<soapenv:Body>
<ns:simpleQuery>
<ns:simpleQueryInput>
<ns1:simpleQueryCategory>ALL_TASKS</ns1:simpleQueryCategory>
</ns:simpleQueryInput>
</ns:simpleQuery>
</soapenv:Body>
</soapenv:Envelope>
This should return a list of currently available tasks.
<soapenv:Header/>
<soapenv:Body>
<ns:simpleQuery>
<ns:simpleQueryInput>
<ns1:simpleQueryCategory>ALL_TASKS</ns1:simpleQueryCategory>
</ns:simpleQueryInput>
</ns:simpleQuery>
</soapenv:Body>
</soapenv:Envelope>
This should return a list of currently available tasks.
Now iterate though the task list and use load task method with the task id to load individual tasks.
Use following soap message.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://docs.oasis-open.org/ns/bpel4people/ws-humantask/api/200803">
<soapenv:Header/>
<soapenv:Body>
<ns:loadTask xmlns:ns="http://docs.oasis-open.org/ns/bpel4people/ws-humantask/api/200803">
<ns:identifier>8405</ns:identifier>
</ns:loadTask>
</soapenv:Body>
</soapenv:Envelope>
This would return all information about the given task.
After you have obtained this data, you can use operations such as start, stop , claim, complete ect with the task id and corresponding xml message.
For example, start task request would look like the following.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://docs.oasis-open.org/ns/bpel4people/ws-humantask/api/200803">
<soapenv:Header/>
<soapenv:Body>
<ns:start xmlns:ns="http://docs.oasis-open.org/ns/bpel4people/ws-humantask/api/200803">
<ns:identifier>8405</ns:identifier>
</ns:start>
</soapenv:Body>
</soapenv:Envelope>
Additionally, you can refer to the human task ui jsp pages of BPS to get more details.
https://svn.wso2.org/repos/wso2/carbon/platform/branches/4.0.0/components/business-processes/humantask/org.wso2.carbon.humantask.ui/4.0.5/src/main/resources/web/humantask
This comment has been removed by the author.
ReplyDeleteHi Nandika
ReplyDelete1. I think It's better to say that the endpoint should be modify before step 3 to :
https://127.0.0.1:9443/services/HumanTaskClientAPIAdmin
because the default value is :http://www.example.org/
2. I found that the wsdl in wso2 source repository has a problem on a Type definition in line 120:"xsd:any", it's corrected in your wsdl:"xsd:anyType", so please correct the repository.
I can't get the response from the endpoint by soapui:
ReplyDeletehttps://127.0.0.1:9443/services/HumanTaskClientAPIAdmin.HumanTaskClientAPIAdminHttpsSoap12Endpoint/
no response or any error message.
OK It's working, It's my fault to set cookie in http header!
ReplyDeleteI would be very nice if you can provide us a sample web app with UI task integrated with the BPS engine. Something like Vaadin(UI)or ZK(UI)[1]+Activiti(Engine)
ReplyDelete[1] http://sourceforge.net/projects/zkabpm/files/zkabpm/alpha/0.0.5/zkabpm_alpha5.war/download
HI Nandika,
ReplyDeleteThank for explaining in details, i am starting the BPS 3.1.0 Server from linux Ubuntu , i am did see any option like " –DosgiConsole.".
while i am running from server i am getting following error.
bash: ./DosgiConsole: No such file or directory
Help me to slove this.
Thanks in Advance
Anil
Hi Anil,
ReplyDeleteYou can start the server as wso2server.sh -DosgiConsole
Regards
Nandika
Hi Nandika,
ReplyDeleteFirst thank you for your postings..I have one query can please help me.
I have to write time based scheduling in BPEL(WSO2 BPS 3.1.0), is this is possible in BPEL, how to write the time based properties in BPEL.Could you please explain me,
Thanks in Advance
Anil
Hi Nandika,
ReplyDeleteThanks for your post. Seems like this link http://people.wso2.com/~nandika/htwsdl/ is not working. Are you planning to re-upload those files?
Hi Nandika,
ReplyDeleteI have the same problem, the link to get the wsdl's (http://people.wso2.com/~nandika/htwsdl/) is not working, can you please provide those files again?
Thanks
Actually, this wsdl issue has been corrected in BPS 3.2.0 release version. You can use ?wsdl to obtain the wsdls.
ReplyDeleteRegards
Nandika
Hi Nandika,
ReplyDeleteThanks for the post. You wrote "When a task instance is created, it will have its own unique task id which will be returned to the task invoker. Additionally, this task id can be obtained by using the simpleQuery operation which returns a list of tasks."
Can you please explain how to get task id from task invoked by bpel process using Bpel4People extension activity?
Thanks
Thanks for the sharing. Nice posting ...!
ReplyDelete