cancel
Showing results for 
Search instead for 
Did you mean: 

Process variable and webservice

kalman
Champ in-the-making
Champ in-the-making
Hi,

We have problem with variable handling in Activiti.

-   We created a variable in process level:
<dataObject id="DO_WebServiceTest_1" itemSubjectRef="xsd:string" name="PROC_DATA"/>


-   We assigned a value to the varaiable in a User task:
    <userTask activiti:formKey="Input" activiti:priority="50" completionQuantity="1" id="_3" implementation="##unspecified" isForCompensation="false" name="Input" startQuantity="1">
      <extensionElements>
        <activiti:formProperty id="IMP1" name="Input data" required="true" type="string" variable="PROC_DATA"/>
      </extensionElements>
      <incoming>_5</incoming>
      <outgoing>_10</outgoing>
      <humanPerformer id="_3_RES_1">
        <resourceAssignmentExpression>
          <formalExpression><![CDATA[gerop]]></formalExpression>
        </resourceAssignmentExpression>
      </humanPerformer>
    </userTask>   

-   We called a webservice with variable as the parameter and after calling it we put the returned value into the process variable:
    <serviceTask completionQuantity="1" id="_9" implementation="##WebService" isForCompensation="false" name="Service Task" operationRef="tns:IF_1_O_1" startQuantity="1">
      <incoming>_10</incoming>
      <outgoing>_11</outgoing>
      <ioSpecification>
        <dataInput id="Din_9_1" isCollection="false" itemSubjectRef="tns:ID_1" name="INPUT"/>
        <dataOutput id="Dout_9_1" isCollection="false" itemSubjectRef="tns:ID_2" name="OUTPUT"/>
        <inputSet>
          <dataInputRefs>Din_9_1</dataInputRefs>
        </inputSet>
        <outputSet>
          <dataOutputRefs>Dout_9_1</dataOutputRefs>
        </outputSet>
      </ioSpecification>
      <dataInputAssociation id="DIA_9_1">
        <sourceRef>DO_WebServiceTest_1</sourceRef>
        <targetRef>Din_9_1</targetRef>
      </dataInputAssociation>
      <dataOutputAssociation id="DOA_9_1">
        <sourceRef>Dout_9_1</sourceRef>
        <targetRef>DO_WebServiceTest_1</targetRef>
      </dataOutputAssociation>
    </serviceTask>

-   We write the content of the process variable in an other user task:
    <userTask activiti:formKey="Output" activiti:priority="50" completionQuantity="1" id="_6" implementation="##unspecified" isForCompensation="false" name="Output" startQuantity="1">
      <extensionElements>
        <activiti:formProperty id="OUT1" name="Output data" type="string" variable="PROC_DATA" writable="false"/>
      </extensionElements>
      <incoming>_11</incoming>
      <outgoing>_8</outgoing>
      <humanPerformer id="_6_RES_1">
        <resourceAssignmentExpression>
          <formalExpression><![CDATA[gerop]]></formalExpression>
        </resourceAssignmentExpression>
      </humanPerformer>
    </userTask>

It seems that the process variable is not passed to the service, since we see NULL as the input value in the log of the webservice, and the returned value didn’t overwrite the content of the original value of the variable. It means on the output form we can see the same value as we assigned in the input form.

Did we do any wrong?
Br.
Kálmán
1 REPLY 1

trademak
Star Contributor
Star Contributor
Hi,

I see a couple of issues:

- You included a formKey attribute and a formProperty definition in the user task. You should use either one of them
- I don't see where the form property variable is set as input to the web service. I see a variable of PROC_DATA and an id of IMP1, but these are not used in the input spec of the web service.

Best regards,