JBoss Community

Re: Start a process remotely by using Java

created by Pierpaolo Lombardi in jBPM - View the full discussion

Anyway, I'm trying using the REST interface to start a process but I have a problem cause the answer I get is the html source of the login form

 

How can I sove this?

 

The code I use is:

 

         URL url = new URL("http://localhost:8080/gwt-console-server/rs/process/definition/HelloHT/new_instance");

          HttpURLConnection conn =

              (HttpURLConnection) url.openConnection();

          conn.setRequestMethod("POST");

          conn.setDoOutput(true);

          conn.setDoInput(true);

          conn.setUseCaches(false);

          conn.setAllowUserInteraction(false);

          conn.setRequestProperty("Content-Type",

              "application/x-www-form-urlencoded");

         

          if (conn.getResponseCode() != 200) {

            throw new IOException(conn.getResponseMessage());

          }

 

          // Buffer the result into a string

          BufferedReader rd = new BufferedReader(

              new InputStreamReader(conn.getInputStream()));

          StringBuilder sb = new StringBuilder();

          String line;

          while ((line = rd.readLine()) != null) {

            sb.append(line);

          }

          rd.close();

          System.out.println(sb.toString());

Reply to this message by going to Community

Start a new discussion in jBPM at Community