JBoss Community

Problem using REST interface

created by satish polasi in jBPM - View the full discussion

Hi,

 

I have my jbpm-console application running on one profle jbpm on 9090 port and my application running on another profile default on 8080 port. I run both the consoles on JbossEAP5.1 server.

 

I have created one bpmn process and deployed on to JBPM engine and I can login to jbpm-cosole application as admin/admin and start the process.

 

My requirement here is, I need to do the same process from my application running on 8080 port. For that i am making a call to this URL http://localhost:9090/gwt-console-server/rs/process/definition/{id}/new_instance to start the process. Where {id} is the processid(InstallSR) of my bpmn process.

 

Here is my code

 

 

        PostMethod post = new PostMethod(http://localhost:9090/gwt-console-server/rs/process/definition/InstallSR/new_instance);

        try {

            post.addRequestHeader("Accept", "application/json");

            int result = httpClient.executeMethod(post);

 

            System.out.println("Response status code: " + result);

            System.out.println("Response body: ");

            System.out.println(post.getResponseBodyAsString());

        } catch (HttpException e) {

            e.printStackTrace();

        } catch (IOException e) {

            e.printStackTrace();

        } finally {

            post.releaseConnection();

        }

 

When i call my above codel I see the following output as below and I don't see any thing printed on my human task servie or jbpm application server console.

 

Response status code: 200

Response body:

<html>

<head>

  <title>HTTP 401</title> <!-- Do not remove -->

</head>

<body>

<form method="POST" action="j_security_check">

 

  <center/>

  <br><br>

 

  <div style="font-family:sans-serif;border:1px solid black; width:270;padding:15px;">

    <h2>BPM Console Server</h2>

 

    <table with=250>

    <tr>

      <td>Username:</td>

      <td><input type="text" name="j_username"></td>

    </tr>

    <tr>

      <td>Password:</td>

      <td><input type="password" name="j_password"></td>

    </tr>

    <tr>

      <td></td>

      <td align=right><input type="submit"/></td>

    </tr>

  </table>

  </div>

</form>

</body>

</html>

 

Can any one help me out on this, what I need to do to start a new process instance by calling rest url.

Thanks a lot in advance

 

Thanks,

Satish.

Reply to this message by going to Community

Start a new discussion in jBPM at Community