[jboss-user] [jBPM] - Re: Start a process remotely by using Java

Pierpaolo Lombardi do-not-reply at jboss.com
Fri Sep 2 10:47:29 EDT 2011


Pierpaolo Lombardi [http://community.jboss.org/people/pierx83] created the discussion

"Re: Start a process remotely by using Java"

To view the discussion, visit: http://community.jboss.org/message/624488#624488

--------------------------------------------------------------
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 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
[http://community.jboss.org/message/624488#624488]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110902/89e1eaaa/attachment-0001.html 


More information about the jboss-user mailing list