Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-9015

KIE-Server rendererd forms bind data to incorrect process variable names

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.35.0.Final
    • 7.32.0.Final
    • KieServer, Workbench
    • None
    • NEW
    • NEW
    • Hide

      1) Start Business-Central with the following property: -Dorg.jbpm.wb.forms.renderer.ext=true
      2) Import the following project: https://github.com/DuncanDoyle/kie-server-form-rendering-issue
      3) Build and Deploy the project.
      4) Start a process instance.
      5) In the process instance screen, inspect the Process Variables tab. Notice that the data is bound to the "OrderInfo" process variable instead of "orderInfo"

      Show
      1) Start Business-Central with the following property: -Dorg.jbpm.wb.forms.renderer.ext=true 2) Import the following project: https://github.com/DuncanDoyle/kie-server-form-rendering-issue 3) Build and Deploy the project. 4) Start a process instance. 5) In the process instance screen, inspect the Process Variables tab. Notice that the data is bound to the "OrderInfo" process variable instead of "orderInfo"
    • 2020 Week 07-09 (from Feb 10), 2020 Week 10-12 (from Mar 2)

      When using the KIE-Server to render the process forms, using the "-Dorg.jbpm.wb.forms.renderer.ext=true" system property, binding of form data to process variables is incorrect.

      What happens is that the data is sent to the KIE-Server using an incorrect variable name (in my reproducer, the data binds to the variable name "OrderInfo" instead of "orderInfo". What seems to happen is that the binding uses the name "OrderInfo" from the Data Object form definition (https://raw.githubusercontent.com/DuncanDoyle/kie-server-form-rendering-issue/master/src/main/resources/com/myspace/kie_server_form_rendering_test/OrderProcess-OrderInfo.frm), instead of the binding name in the the process start form: https://raw.githubusercontent.com/DuncanDoyle/kie-server-form-rendering-issue/master/src/main/resources/com/myspace/kie_server_form_rendering_test/kie-server-form-rendering-test.order-process-taskform.frm

      Looking at the RESTful communication between Business Central and KIE-Server, we can see the rendered form definition and how it binds data to "OrderInfo" instead of "orderInfo":

      GET /kie-server/services/rest/server/containers/kie-server-form-rendering-test_1.0.0-SNAPSHOT/forms/processes/kie-server-form-rendering-test.order-process/content?renderer=workbench HTTP/1.1
      Accept: text/html
      X-KIE-ContentType: JSON
      Authorization: Basic cGFtQWRtaW46cmVkaGF0cGFtMSE=
      X-KIE-ConversationId: %27default-kieserver%27%3A%27kie-server-form-rendering-test_1.0.0-SNAPSHOT%27%3A%27com.myspace%3Akie-server-form-rendering-test%3A1.0.0-SNAPSHOT%27%3A%2766b0a995-0cdc-4c13-b7df-37dd51ed7f0f%27
      User-Agent: Java/1.8.0_201
      Host: localhost:8080
      Connection: keep-alive
      

      HTTP/1.1 200 OK
      Expires: 0
      Cache-Control: no-cache, no-store, must-revalidate
      X-Powered-By: Undertow/1
      Server: JBoss-EAP/7
      Pragma: no-cache
      Date: Wed, 05 Feb 2020 11:46:11 GMT
      Connection: keep-alive
      Content-Type: text/html;charset=UTF-8
      Content-Length: 2571
      

      <!DOCTYPE html>
      <html lang="en">
      <head>
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
      <!-- Patternfly -->
      <link href="http://localhost:8080/kie-server/services/rest/server/files/patternfly/css/patternfly.min.css" rel="stylesheet">
      <link href="http://localhost:8080/kie-server/services/rest/server/files/patternfly/css/patternfly-additions.min.css" rel="stylesheet">
      </head>
      <body>
      	<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
      	<script src="http://localhost:8080/kie-server/services/rest/server/files/patternfly/js/jquery.min.js"></script>
      	<script src="http://localhost:8080/kie-server/services/rest/server/files/patternfly/js/patternfly.min.js"></script>
      	<script src="http://localhost:8080/kie-server/services/rest/server/files/js/kieserver-ui.js"></script>
      

      	<div class="panel panel-default">
      		<div class="panel-heading">
      			<h3 class="panel-title">kie-server-form-rendering-test.order-process-taskform</h3>
      		</div>
      		<div class="panel-body">
      			<div id="successAlert" class="alert alert-success hidden" role="alert"></div>
      			<div id="failureAlert" class="alert alert-danger hidden" role="alert"></div>
      			<div class="container-fluid">
      		<div class="row">
      		<div class="col-md-12"><div class="row">
      	<div class="col-md-12">
      		<h3>OrderProcess-OrderInfo</h3>
      		<hr/>
      	</div>
      </div><div class="container-fluid">
      		<div class="row">
      		<div class="col-md-12">
      <div class="form-group">
      	<label for="field_7881">Order ID</label> 
      	<input name="orderId" type="text" class="form-control" id="field_7881" placeholder="Order ID" value="" pattern=""  >
      </div>
      </div>
      	</div>
      </div></div>
      	</div>
      	<div class="row">
      		<div class="col-md-12">
      			<hr/>
      		</div>
      	</div>
      	<div class="row">
      		<div class="col-md-12">
      			<button type="button" class="btn btn-primary" onclick="startProcess(this);">Submit</button>
      		</div>
      	</div>
      </div>
      		</div>
      	</div>
      

      	<script>
      		function getData() { 
      return {'OrderInfo' : {'com.myspace.kie_server_form_rendering_test.OrderInfo' : {'orderId' : String(document.getElementById('field_7881').value)}}}
       };
      function getProcessEndpoint() { 
      return 'forms/containers/kie-server-form-rendering-test_1.0.0-SNAPSHOT/processes/kie-server-form-rendering-test.order-process/instances';
       };
      function initializeForm() { 
      

       };
      function endpointSuffix() { 
      return 'templateid=default-kieserver';
       };
      

      	</script>
      </body>
      </html>
      

      When you look at the POST request that Business Central sends when creating a new process instance, we can again see how the process variable name used is "OrderInfo" instead of "orderInfo":

      POST /kie-server/services/rest/server/containers/kie-server-form-rendering-test_1.0.0-SNAPSHOT/processes/kie-server-form-rendering-test.order-process/instances HTTP/1.1
      Accept: application/json
      X-KIE-ContentType: JSON
      Authorization: Basic cGFtQWRtaW46cmVkaGF0cGFtMSE=
      X-KIE-ConversationId: %27default-kieserver%27%3A%27kie-server-form-rendering-test_1.0.0-SNAPSHOT%27%3A%27com.myspace%3Akie-server-form-rendering-test%3A1.0.0-SNAPSHOT%27%3A%2766b0a995-0cdc-4c13-b7df-37dd51ed7f0f%27
      Content-Type: application/json
      User-Agent: Java/1.8.0_201
      Host: localhost:8080
      Connection: keep-alive
      Content-Length: 86
      

      {"OrderInfo":{"com.myspace.kie_server_form_rendering_test.OrderInfo":{"orderId":"1"}}}
      

      All of this causes the data not to be bound to the correct process variable, and hence is not available in the next User Task.

      This problem does not occur when we use Business Central to render the forms instead of KIE-Server (i.e. if we don't set the "-Dorg.jbpm.wb.forms.renderer.ext=true" System Property).

            elguardian@gmail.com Enrique González Martínez (Inactive)
            rhn-gps-ddoyle Duncan Doyle (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: