Set process instance variables and get task input

876 views
Skip to first unread message

vinhd...@ved.com.vn

unread,
Jan 18, 2017, 4:55:45 AM1/18/17
to jBPM Usage
I've been research jBPM for the past month, but i still struggle with some of its APIs

1. First one is set process instance variables.
- I use /rest/execute in attempt to use SetProcessInstanceVariablesCommand but with no luck
- Here is my request

Request body:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<command-request>
 
<deployment-id>ved:PrinterManagement:1.0</deployment-id>
 
<set-process-instance-variables processInstanceId="5">

   
<parameter>
     
<item key="NVRSD_UID">
       
<value xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema"
               
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">11</value>
     
</item>
   
</parameter>
 
</set-process-instance-variables>
</command-request>


The request response with status 200, and data:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<command-response>
   
<deployment-id>ved:PrinterManagement:1.0</deployment-id>
</command-response>


Result: var NVRSD_UID not set in process instance


2. Second one is way get task input
- I can't figure out the way to get input of some task. E.g: task A want id as String, imported_date as Date
- I've tried using showTaskForm, but that API is such a pain, i can't embedded in my client application (because of cross domain), 
- and jbpm-forms-rest-integration.js also didn't work because it make unauthorized request (401)


Please someone help me with these 2 problems.
I'm installed jBPM 6.5.0 Final on Ubuntu 14.04

vinhd...@ved.com.vn

unread,
Jan 18, 2017, 4:58:31 AM1/18/17
to jBPM Usage
Edit:
Request body is:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<command-request>
 
<deployment-id>ved:PrinterManagement:1.0</deployment-id>
 
<set-process-instance-variables processInstanceId="5">


   
<variables>

     
<item key="NVRSD_UID">
       
<value xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema"
               
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">11</value>
     
</item>

   
</variables>
 
</set-process-instance-variables>
</command-request>


Vĩnh Đạt(COD) Hà

unread,
Jan 18, 2017, 10:25:04 PM1/18/17
to jBPM Usage
any help please?

Maciej Swiderski

unread,
Jan 20, 2017, 2:50:01 AM1/20/17
to Vĩnh Đạt(COD) Hà, jBPM Usage
I'd recommend you to use KIE Server instead that has easier to consumer API and provides simple way of setting process variables. When it comes to second question it does come with definition service exposed as well so you can get task information over REST as well.

Once deployed KIE Server all available endpoints you can find at http://localhost:8080/kie-server/docs

Maciej

2017-01-19 4:25 GMT+01:00 Vĩnh Đạt(COD) Hà <vinhd...@ved.com.vn>:
any help please?

--
You received this message because you are subscribed to the Google Groups "jBPM Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jbpm-usage+unsubscribe@googlegroups.com.
To post to this group, send email to jbpm-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jbpm-usage/721e4f5a-cafb-451b-812f-09910a422390%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Vĩnh Đạt(COD) Hà

unread,
Jan 20, 2017, 3:42:29 AM1/20/17
to jBPM Usage, vinhd...@ved.com.vn
Hi Maciej,

Thanks for your response, i've looked over the kie server api,

1. I created a container (name: evalserver to manage stuffs on Evaluation)
3. Then i call http://localhost:8080/kie-server/services/rest/server/containers/evalserver/processes/instances/4/variable/reason tried to get variable reason value, but the request response with 'Could not find container "evalserver"'

Am i missing something?

Screenshot of execution server:




On Friday, January 20, 2017 at 2:50:01 PM UTC+7, Maciej Swiderski wrote:
I'd recommend you to use KIE Server instead that has easier to consumer API and provides simple way of setting process variables. When it comes to second question it does come with definition service exposed as well so you can get task information over REST as well.

Once deployed KIE Server all available endpoints you can find at http://localhost:8080/kie-server/docs

Maciej
2017-01-19 4:25 GMT+01:00 Vĩnh Đạt(COD) Hà <vinhd...@ved.com.vn>:
any help please?

--
You received this message because you are subscribed to the Google Groups "jBPM Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jbpm-usage+...@googlegroups.com.

To post to this group, send email to jbpm-...@googlegroups.com.

Donato Marrazzo

unread,
Jan 20, 2017, 4:23:33 AM1/20/17
to jBPM Usage, vinhd...@ved.com.vn
I suspect that the problem is due to the fact that you created the instance in the business central and now you are going to call the kie server API.
If you use RedHat BPMS v6.4 or jBPM v6.5, you can do that but your container name should be the same of deployment descriptor of your kjar. e.g. org.test:test:1.0-SNAPSHOT

karaban...@gmail.com

unread,
Jun 4, 2018, 5:13:07 AM6/4/18
to jBPM Usage
Hi, i have the same issue.
Im my case i had this message in logs: "[org.kie.remote.services.rest.ExecuteResourceImpl] (default task-6) Commands request object with no commands sent!"

Then i looked to source code:  http://grepcode.com/file/repository.jboss.org/nexus/content/repositories/releases/org.kie.remote/kie-remote-services/6.3.0.Beta2/org/kie/remote/services/jaxb/JaxbCommandsRequest.java#130
Maybe, you should replace"set-process-instance-variables" to "set-process-instance-vars".
For example:

<command-request>
  <deployment-id>org.guvnor:guvnor-asset-mgmt-project:6.5.0.Final</deployment-id>
  <set-process-instance-vars processInstanceId="572">
    <variables>
      <item key="test">
        <value xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">test</value>
      </item>
    </variables>
  </set-process-instance-vars>
</command-request>



пятница, 20 января 2017 г., 13:42:29 UTC+5 пользователь Vĩnh Đạt(COD) Hà написал:
Reply all
Reply to author
Forward
0 new messages