5 Replies Latest reply on Aug 26, 2014 12:35 PM by Samrat Roy

    Not able to get variables for a process instance through Rest Remote API

    James Bryan Johnson Newbie

      While I can start (and abort) a process instance following the documentation, I am unable to get the variables for a process.

       

      I started with code borrowed from:

       

      droolsjbpm-integration/kie-remote/kie-services-client/src/test/java/org/kie/services/client/api/LiveServerTest.java at m…

       

      While the first post request to create the process instance works. The 2nd get request fails

       

      @Test
      public void restAnonymousTaskInitiator3Test() throws Exception {
              ClientRequestFactory requestFactory;
              requestFactory = RestRequestHelper.createRequestFactory(
                      "http://qepdv-app05.ams.int:8080/rest", userId, password,
                      10 * 1000);
              // Create (start process) request
              String urlString = new URL(deploymentUrl, deploymentUrl.getPath()
                      + "rest/runtime/" + deploymentId + "/process/evaluation/start")
                      .toExternalForm();
              urlString = urlString + "?map_employee=mary";
              ClientRequest restRequest = requestFactory.createRequest(urlString);
              logger.debug(">> " + urlString);
              // Post, get response, check status response, and get info
              ClientResponse<?> responseObj = checkResponse(restRequest.post());
              JaxbProcessInstanceResponse processInstance = (JaxbProcessInstanceResponse) responseObj
                      .getEntity(JaxbProcessInstanceResponse.class);
              long procInstId = processInstance.getId();
              urlString = new URL(deploymentUrl, deploymentUrl.getPath()
                      + "rest/runtime/" + deploymentId + "/process/instance/"
                      + procInstId + "/variables").toExternalForm();
              restRequest = requestFactory.createRequest(urlString);
              logger.debug(">> " + urlString);
              // Get, get response, check status response, and get info
              responseObj = checkResponse(restRequest.get());
              JaxbVariablesResponse response = (JaxbVariablesResponse) responseObj
                      .getEntity(JaxbVariablesResponse.class);
              logger.debug("response obj >> " + response.toString());
      
          }
      

       

      Here is the relevant part of the logging:

      <exception>

          <status>NOT_FOUND</status>

          <url>http://qepdv-app05.ams.int:8080/kie-wb/rest/runtime/org.jbpm:Evaluation:1.0.2/process/instance/154/variables</url>

          <message>NotFoundException thrown with message 'Could not find resource for relative : /runtime/org.jbpm:Evaluation:1.0.2/process/instance/154/variables of full path: http://qepdv-app05.ams.int:8080/kie-wb/rest/runtime/org.jbpm:Evaluation:1.0.2/process/instance/154/variables'</message>

          <stackTrace>org.jboss.resteasy.spi.NotFoundException: Could not find resource for relative : /runtime/org.jbpm:Evaluation:1.0.2/process/instance/154/variables of full path: http://qepdv-app05.ams.int:8080/kie-wb/rest/runtime/org.jbpm:Evaluation:1.0.2/process/instance/154/variables

       

      I think that I am using the variables process call correctly

      [GET] /runtime/ {deploymentId} /process/instance/ {procInstId} /variables

       

      f I use the abort process call:

      [POST] /runtime/ {deploymentId} /process/instance/ {procInstId+} /abort

      It works fine.

       

      Any suggestions as to what I am doing wrong?

       

      Thanks in advance.