5 Replies Latest reply on Mar 4, 2015 12:51 AM by biswajit.sarkar

    Rest Task Error

    biswajit.sarkar

      I am using Jboss BPMS 6.0.3.GA.

       

      I am trying to create a process where I added a Rest Task to call Jboss BPMS own REST Api.

      here is my rest uri ...

      http://localhost:8080/business-central/rest/history/process/project1.RestTask_Process1

      If I try this uri from firefox rest client with "Basic Authentication", I'm getting response (Status 200).

       

      But whenever I try this same uri from Rest Task, I am getting Unauthorized Error(Status 401)

      here is my REST Task config....

       

      rest task.PNG

       

      Is it really possible to invoke JBoss BPMS own Rest Api from a Rest Task?

      or is it a bug of JBoss BPMS like this https://bugzilla.redhat.com/show_bug.cgi?id=1086639

       

      anyone please confirm this . I am using Jboss BPMS 6.0.3.GA.

        • 1. Re: Rest Task Error
          biswajit.sarkar

          Rafael Chies can you please confirm this

          Thanks in advance

          • 2. Re: Rest Task Error
            rafachies

            The response code 401 is saying that you are not authenticated to the "business-central" to do this. When you are calling the same URL through a browser, probably your are already authenticated, maybe because you have logged in on business-central in the same Browser.

             

            The REST Work Item Handler has some parameters that you configure in your task, like URL, method, parameters, etc. Two of those parameters are Username and Password, that is used for basic authentication, fill it if the business-central credentials, and should work.

            • 3. Re: Rest Task Error
              biswajit.sarkar

              Rafael Chies

              I am still getting status 401.

              2015-02-28 16:08:26,889 WARN  [org.jbpm.process.workitem.rest.RESTWorkItemHandler] (default task-39) Unsuccessful response from REST server (status 401, endpoint http://localhost:8080/jbpm-console/rest/history/process/Project1.Rest_Process, response <html><head><title>Error</title></head><body>Validation fails.</body></html>

               

               

              I just created a simple process with a REST Service Task and from that REST Service task I try to invoke JBPM's own Rest API.

               

              following is my process file

               

              <?xml version="1.0" encoding="UTF-8"?>

              <bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.omg.org/bpmn20" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:bpsim="http://www.bpsim.org/schemas/1.0" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:drools="http://www.jboss.org/drools" id="_yBsCcL82EeSaW7VVBFo5DQ" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd http://www.jboss.org/drools drools.xsd http://www.bpsim.org/schemas/1.0 bpsim.xsd" expressionLanguage="http://www.mvel.org/2.0" targetNamespace="http://www.omg.org/bpmn20" typeLanguage="http://www.java.com/javaTypes">

                <bpmn2:itemDefinition id="__9BCBF846-E34E-4896-800B-2FEE96732414_MethodInputXItem" structureRef="String"/>

                <bpmn2:itemDefinition id="__9BCBF846-E34E-4896-800B-2FEE96732414_UrlInputXItem" structureRef="String"/>

                <bpmn2:itemDefinition id="__9BCBF846-E34E-4896-800B-2FEE96732414_PasswordInputXItem" structureRef="String"/>

                <bpmn2:itemDefinition id="__9BCBF846-E34E-4896-800B-2FEE96732414_ConnectTimeoutInputXItem" structureRef="String"/>

                <bpmn2:itemDefinition id="__9BCBF846-E34E-4896-800B-2FEE96732414_UsernameInputXItem" structureRef="String"/>

                <bpmn2:itemDefinition id="__9BCBF846-E34E-4896-800B-2FEE96732414_ReadTimeoutInputXItem" structureRef="String"/>

                <bpmn2:itemDefinition id="__9BCBF846-E34E-4896-800B-2FEE96732414_ResultOutputXItem" structureRef="java.lang.Object"/>

                <bpmn2:process id="Project1.RestTask_Process1" drools:packageName="org.jbpm" drools:version="1.0" name="RestTask_Process1" isExecutable="true">

                  <bpmn2:startEvent id="processStartEvent" drools:bgcolor="#9acd32" drools:selectable="true" name="">

                    <bpmn2:outgoing>_C51076AF-5B74-4255-8CFD-8A160D20CD3D</bpmn2:outgoing>

                  </bpmn2:startEvent>

                  <bpmn2:task id="_9BCBF846-E34E-4896-800B-2FEE96732414" drools:selectable="true" drools:taskName="Rest" name="REST">

                    <bpmn2:incoming>_C51076AF-5B74-4255-8CFD-8A160D20CD3D</bpmn2:incoming>

                    <bpmn2:outgoing>_8A0CF16B-006C-44A0-8218-AD43BD76BD30</bpmn2:outgoing>

                    <bpmn2:ioSpecification id="_yBsCcb82EeSaW7VVBFo5DQ">

                      <bpmn2:dataInput id="_9BCBF846-E34E-4896-800B-2FEE96732414_TaskNameInputX" name="TaskName"/>

                      <bpmn2:dataInput id="_9BCBF846-E34E-4896-800B-2FEE96732414_MethodInputX" drools:dtype="String" itemSubjectRef="__9BCBF846-E34E-4896-800B-2FEE96732414_MethodInputXItem" name="Method"/>

                      <bpmn2:dataInput id="_9BCBF846-E34E-4896-800B-2FEE96732414_UrlInputX" drools:dtype="String" itemSubjectRef="__9BCBF846-E34E-4896-800B-2FEE96732414_UrlInputXItem" name="Url"/>

                      <bpmn2:dataInput id="_9BCBF846-E34E-4896-800B-2FEE96732414_PasswordInputX" drools:dtype="String" itemSubjectRef="__9BCBF846-E34E-4896-800B-2FEE96732414_PasswordInputXItem" name="Password"/>

                      <bpmn2:dataInput id="_9BCBF846-E34E-4896-800B-2FEE96732414_ConnectTimeoutInputX" drools:dtype="String" itemSubjectRef="__9BCBF846-E34E-4896-800B-2FEE96732414_ConnectTimeoutInputXItem" name="ConnectTimeout"/>

                      <bpmn2:dataInput id="_9BCBF846-E34E-4896-800B-2FEE96732414_UsernameInputX" drools:dtype="String" itemSubjectRef="__9BCBF846-E34E-4896-800B-2FEE96732414_UsernameInputXItem" name="Username"/>

                      <bpmn2:dataInput id="_9BCBF846-E34E-4896-800B-2FEE96732414_ReadTimeoutInputX" drools:dtype="String" itemSubjectRef="__9BCBF846-E34E-4896-800B-2FEE96732414_ReadTimeoutInputXItem" name="ReadTimeout"/>

                      <bpmn2:dataOutput id="_9BCBF846-E34E-4896-800B-2FEE96732414_ResultOutputX" drools:dtype="java.lang.Object" itemSubjectRef="__9BCBF846-E34E-4896-800B-2FEE96732414_ResultOutputXItem" name="Result"/>

                      <bpmn2:inputSet id="_yBsCcr82EeSaW7VVBFo5DQ">

                        <bpmn2:dataInputRefs>_9BCBF846-E34E-4896-800B-2FEE96732414_MethodInputX</bpmn2:dataInputRefs>

                        <bpmn2:dataInputRefs>_9BCBF846-E34E-4896-800B-2FEE96732414_UrlInputX</bpmn2:dataInputRefs>

                        <bpmn2:dataInputRefs>_9BCBF846-E34E-4896-800B-2FEE96732414_PasswordInputX</bpmn2:dataInputRefs>

                        <bpmn2:dataInputRefs>_9BCBF846-E34E-4896-800B-2FEE96732414_ConnectTimeoutInputX</bpmn2:dataInputRefs>

                        <bpmn2:dataInputRefs>_9BCBF846-E34E-4896-800B-2FEE96732414_UsernameInputX</bpmn2:dataInputRefs>

                        <bpmn2:dataInputRefs>_9BCBF846-E34E-4896-800B-2FEE96732414_ReadTimeoutInputX</bpmn2:dataInputRefs>

                        <bpmn2:dataInputRefs>_9BCBF846-E34E-4896-800B-2FEE96732414_TaskNameInputX</bpmn2:dataInputRefs>

                      </bpmn2:inputSet>

                      <bpmn2:outputSet id="_yBsCc782EeSaW7VVBFo5DQ">

                        <bpmn2:dataOutputRefs>_9BCBF846-E34E-4896-800B-2FEE96732414_ResultOutputX</bpmn2:dataOutputRefs>

                      </bpmn2:outputSet>

                    </bpmn2:ioSpecification>

                    <bpmn2:dataInputAssociation id="_yBsCdL82EeSaW7VVBFo5DQ">

                      <bpmn2:targetRef>_9BCBF846-E34E-4896-800B-2FEE96732414_TaskNameInputX</bpmn2:targetRef>

                      <bpmn2:assignment id="_yBsCdb82EeSaW7VVBFo5DQ">

                        <bpmn2:from xsi:type="bpmn2:tFormalExpression" id="_yBsCdr82EeSaW7VVBFo5DQ">Rest</bpmn2:from>

                        <bpmn2:to xsi:type="bpmn2:tFormalExpression" id="_yBsCd782EeSaW7VVBFo5DQ">_9BCBF846-E34E-4896-800B-2FEE96732414_TaskNameInputX</bpmn2:to>

                      </bpmn2:assignment>

                    </bpmn2:dataInputAssociation>

                    <bpmn2:dataInputAssociation id="_yBspgL82EeSaW7VVBFo5DQ">

                      <bpmn2:targetRef>_9BCBF846-E34E-4896-800B-2FEE96732414_MethodInputX</bpmn2:targetRef>

                      <bpmn2:assignment id="_yBspgb82EeSaW7VVBFo5DQ">

                        <bpmn2:from xsi:type="bpmn2:tFormalExpression" id="_yBspgr82EeSaW7VVBFo5DQ"><![CDATA[GET]]></bpmn2:from>

                        <bpmn2:to xsi:type="bpmn2:tFormalExpression" id="_yBspg782EeSaW7VVBFo5DQ">_9BCBF846-E34E-4896-800B-2FEE96732414_MethodInputX</bpmn2:to>

                      </bpmn2:assignment>

                    </bpmn2:dataInputAssociation>

                    <bpmn2:dataInputAssociation id="_yBsphL82EeSaW7VVBFo5DQ">

                      <bpmn2:targetRef>_9BCBF846-E34E-4896-800B-2FEE96732414_UrlInputX</bpmn2:targetRef>

                      <bpmn2:assignment id="_yBsphb82EeSaW7VVBFo5DQ">

                        <bpmn2:from xsi:type="bpmn2:tFormalExpression" id="_yBsphr82EeSaW7VVBFo5DQ"><![CDATA[http://localhost:8080/business-central/rest/history/process/project1.RestTask_Process1]]></bpmn2:from>

                        <bpmn2:to xsi:type="bpmn2:tFormalExpression" id="_yBsph782EeSaW7VVBFo5DQ">_9BCBF846-E34E-4896-800B-2FEE96732414_UrlInputX</bpmn2:to>

                      </bpmn2:assignment>

                    </bpmn2:dataInputAssociation>

                    <bpmn2:dataInputAssociation id="_yBspiL82EeSaW7VVBFo5DQ">

                      <bpmn2:targetRef>_9BCBF846-E34E-4896-800B-2FEE96732414_PasswordInputX</bpmn2:targetRef>

                      <bpmn2:assignment id="_yBspib82EeSaW7VVBFo5DQ">

                        <bpmn2:from xsi:type="bpmn2:tFormalExpression" id="_yBspir82EeSaW7VVBFo5DQ"><![CDATA[admin]]></bpmn2:from>

                        <bpmn2:to xsi:type="bpmn2:tFormalExpression" id="_yBspi782EeSaW7VVBFo5DQ">_9BCBF846-E34E-4896-800B-2FEE96732414_PasswordInputX</bpmn2:to>

                      </bpmn2:assignment>

                    </bpmn2:dataInputAssociation>

                    <bpmn2:dataInputAssociation id="_yBspjL82EeSaW7VVBFo5DQ">

                      <bpmn2:targetRef>_9BCBF846-E34E-4896-800B-2FEE96732414_ConnectTimeoutInputX</bpmn2:targetRef>

                      <bpmn2:assignment id="_yBspjb82EeSaW7VVBFo5DQ">

                        <bpmn2:from xsi:type="bpmn2:tFormalExpression" id="_yBspjr82EeSaW7VVBFo5DQ"><![CDATA[60000]]></bpmn2:from>

                        <bpmn2:to xsi:type="bpmn2:tFormalExpression" id="_yBspj782EeSaW7VVBFo5DQ">_9BCBF846-E34E-4896-800B-2FEE96732414_ConnectTimeoutInputX</bpmn2:to>

                      </bpmn2:assignment>

                    </bpmn2:dataInputAssociation>

                    <bpmn2:dataInputAssociation id="_yBspkL82EeSaW7VVBFo5DQ">

                      <bpmn2:targetRef>_9BCBF846-E34E-4896-800B-2FEE96732414_UsernameInputX</bpmn2:targetRef>

                      <bpmn2:assignment id="_yBspkb82EeSaW7VVBFo5DQ">

                        <bpmn2:from xsi:type="bpmn2:tFormalExpression" id="_yBspkr82EeSaW7VVBFo5DQ"><![CDATA[admin]]></bpmn2:from>

                        <bpmn2:to xsi:type="bpmn2:tFormalExpression" id="_yBspk782EeSaW7VVBFo5DQ">_9BCBF846-E34E-4896-800B-2FEE96732414_UsernameInputX</bpmn2:to>

                      </bpmn2:assignment>

                    </bpmn2:dataInputAssociation>

                    <bpmn2:dataInputAssociation id="_yBsplL82EeSaW7VVBFo5DQ">

                      <bpmn2:targetRef>_9BCBF846-E34E-4896-800B-2FEE96732414_ReadTimeoutInputX</bpmn2:targetRef>

                      <bpmn2:assignment id="_yBsplb82EeSaW7VVBFo5DQ">

                        <bpmn2:from xsi:type="bpmn2:tFormalExpression" id="_yBsplr82EeSaW7VVBFo5DQ"><![CDATA[60000]]></bpmn2:from>

                        <bpmn2:to xsi:type="bpmn2:tFormalExpression" id="_yBspl782EeSaW7VVBFo5DQ">_9BCBF846-E34E-4896-800B-2FEE96732414_ReadTimeoutInputX</bpmn2:to>

                      </bpmn2:assignment>

                    </bpmn2:dataInputAssociation>

                  </bpmn2:task>

                  <bpmn2:endEvent id="_7DDD3465-F156-483D-80BA-C72ABE64875D" drools:bgcolor="#ff6347" drools:selectable="true" name="">

                    <bpmn2:incoming>_8A0CF16B-006C-44A0-8218-AD43BD76BD30</bpmn2:incoming>

                  </bpmn2:endEvent>

                  <bpmn2:sequenceFlow id="_8A0CF16B-006C-44A0-8218-AD43BD76BD30" drools:bgcolor="#000000" drools:selectable="true" sourceRef="_9BCBF846-E34E-4896-800B-2FEE96732414" targetRef="_7DDD3465-F156-483D-80BA-C72ABE64875D"/>

                  <bpmn2:sequenceFlow id="_C51076AF-5B74-4255-8CFD-8A160D20CD3D" drools:bgcolor="#000000" drools:selectable="true" sourceRef="processStartEvent" targetRef="_9BCBF846-E34E-4896-800B-2FEE96732414"/>

                </bpmn2:process>

                <bpmndi:BPMNDiagram id="_yBtQkL82EeSaW7VVBFo5DQ">

                  <bpmndi:BPMNPlane id="_yBtQkb82EeSaW7VVBFo5DQ" bpmnElement="Project1.Rest_Process">

                    <bpmndi:BPMNShape id="_yBtQkr82EeSaW7VVBFo5DQ" bpmnElement="processStartEvent">

                      <dc:Bounds height="30.0" width="30.0" x="75.0" y="90.0"/>

                    </bpmndi:BPMNShape>

                    <bpmndi:BPMNShape id="_yBtQk782EeSaW7VVBFo5DQ" bpmnElement="_9BCBF846-E34E-4896-800B-2FEE96732414">

                      <dc:Bounds height="80.0" width="100.0" x="210.0" y="60.0"/>

                    </bpmndi:BPMNShape>

                    <bpmndi:BPMNShape id="_yBtQlL82EeSaW7VVBFo5DQ" bpmnElement="_7DDD3465-F156-483D-80BA-C72ABE64875D">

                      <dc:Bounds height="28.0" width="28.0" x="351.0" y="87.0"/>

                    </bpmndi:BPMNShape>

                    <bpmndi:BPMNEdge id="_yBtQlb82EeSaW7VVBFo5DQ" bpmnElement="_8A0CF16B-006C-44A0-8218-AD43BD76BD30">

                      <di:waypoint xsi:type="dc:Point" x="260.0" y="100.0"/>

                      <di:waypoint xsi:type="dc:Point" x="331.0" y="100.0"/>

                      <di:waypoint xsi:type="dc:Point" x="331.0" y="103.0"/>

                      <di:waypoint xsi:type="dc:Point" x="365.0" y="101.0"/>

                    </bpmndi:BPMNEdge>

                    <bpmndi:BPMNEdge id="_yBtQlr82EeSaW7VVBFo5DQ" bpmnElement="_C51076AF-5B74-4255-8CFD-8A160D20CD3D">

                      <di:waypoint xsi:type="dc:Point" x="90.0" y="105.0"/>

                      <di:waypoint xsi:type="dc:Point" x="157.0" y="105.0"/>

                      <di:waypoint xsi:type="dc:Point" x="157.0" y="100.0"/>

                      <di:waypoint xsi:type="dc:Point" x="260.0" y="100.0"/>

                    </bpmndi:BPMNEdge>

                  </bpmndi:BPMNPlane>

                </bpmndi:BPMNDiagram>

                <bpmn2:relationship id="_yBtQl782EeSaW7VVBFo5DQ" type="BPSimData">

                  <bpmn2:extensionElements>

                    <bpsim:BPSimData>

                      <bpsim:Scenario xsi:type="bpsim:Scenario" id="default" name="Simulationscenario">

                        <bpsim:ScenarioParameters xsi:type="bpsim:ScenarioParameters" baseTimeUnit="min"/>

                        <bpsim:ElementParameters xsi:type="bpsim:ElementParameters" elementRef="_8A0CF16B-006C-44A0-8218-AD43BD76BD30" id="_yBtQmL82EeSaW7VVBFo5DQ">

                          <bpsim:ControlParameters xsi:type="bpsim:ControlParameters">

                            <bpsim:Probability xsi:type="bpsim:Parameter">

                              <bpsim:FloatingParameter value="100.0"/>

                            </bpsim:Probability>

                          </bpsim:ControlParameters>

                        </bpsim:ElementParameters>

                        <bpsim:ElementParameters xsi:type="bpsim:ElementParameters" elementRef="processStartEvent" id="_yBtQmb82EeSaW7VVBFo5DQ">

                          <bpsim:TimeParameters xsi:type="bpsim:TimeParameters">

                            <bpsim:ProcessingTime xsi:type="bpsim:Parameter">

                              <bpsim:UniformDistribution max="10.0" min="5.0"/>

                            </bpsim:ProcessingTime>

                          </bpsim:TimeParameters>

                          <bpsim:ControlParameters xsi:type="bpsim:ControlParameters">

                            <bpsim:Probability xsi:type="bpsim:Parameter">

                              <bpsim:FloatingParameter value="100.0"/>

                            </bpsim:Probability>

                          </bpsim:ControlParameters>

                        </bpsim:ElementParameters>

                        <bpsim:ElementParameters xsi:type="bpsim:ElementParameters" elementRef="_C51076AF-5B74-4255-8CFD-8A160D20CD3D" id="_yBtQmr82EeSaW7VVBFo5DQ">

                          <bpsim:ControlParameters xsi:type="bpsim:ControlParameters">

                            <bpsim:Probability xsi:type="bpsim:Parameter">

                              <bpsim:FloatingParameter value="100.0"/>

                            </bpsim:Probability>

                          </bpsim:ControlParameters>

                        </bpsim:ElementParameters>

                        <bpsim:ElementParameters xsi:type="bpsim:ElementParameters" elementRef="_9BCBF846-E34E-4896-800B-2FEE96732414" id="_yBtQm782EeSaW7VVBFo5DQ">

                          <bpsim:TimeParameters xsi:type="bpsim:TimeParameters">

                            <bpsim:ProcessingTime xsi:type="bpsim:Parameter">

                              <bpsim:UniformDistribution max="10.0" min="5.0"/>

                            </bpsim:ProcessingTime>

                          </bpsim:TimeParameters>

                          <bpsim:CostParameters xsi:type="bpsim:CostParameters">

                            <bpsim:UnitCost xsi:type="bpsim:Parameter">

                              <bpsim:FloatingParameter value="0.0"/>

                            </bpsim:UnitCost>

                          </bpsim:CostParameters>

                        </bpsim:ElementParameters>

                        <bpsim:ElementParameters xsi:type="bpsim:ElementParameters" elementRef="_7DDD3465-F156-483D-80BA-C72ABE64875D" id="_yBt3oL82EeSaW7VVBFo5DQ">

                          <bpsim:TimeParameters xsi:type="bpsim:TimeParameters">

                            <bpsim:ProcessingTime xsi:type="bpsim:Parameter">

                              <bpsim:UniformDistribution max="10.0" min="5.0"/>

                            </bpsim:ProcessingTime>

                          </bpsim:TimeParameters>

                        </bpsim:ElementParameters>

                      </bpsim:Scenario>

                    </bpsim:BPSimData>

                  </bpmn2:extensionElements>

                  <bpmn2:source>_yBsCcL82EeSaW7VVBFo5DQ</bpmn2:source>

                  <bpmn2:target>_yBsCcL82EeSaW7VVBFo5DQ</bpmn2:target>

                </bpmn2:relationship>

              </bpmn2:definitions>

               

               

               

              please help me..

              • 4. Re: Rest Task Error
                rafachies

                I tested here and had the same issue. It looks like a bug, but let me go deep on this, and I return as soon as possible.

                • 5. Re: Rest Task Error
                  biswajit.sarkar

                  Rafael Chies wrote:

                   

                  I tested here and had the same issue. It looks like a bug, but let me go deep on this, and I return as soon as possible.

                  thanks Rafael Chies to confirm this