<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Problem using REST interface
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/satishpolasi">satish polasi</a> in <i>jBPM</i> - <a href="http://community.jboss.org/message/600525#600525">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span>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 </span><a class="jive-link-external-small" href="http://localhost:9090/gwt-console-server/rs/process/definition/" target="_blank">http://localhost:9090/gwt-console-server/rs/process/definition/</a><span>{id}/new_instance to start the process. Where {id} is the processid(InstallSR) of my bpmn process.</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Here is my code</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160; PostMethod post = new PostMethod(</span><a class="jive-link-external-small" href="http://localhost:9090/gwt-console-server/rs/process/definition/InstallSR/new_instance);" target="_blank">http://localhost:9090/gwt-console-server/rs/process/definition/InstallSR/new_instance);</a></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; try {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; post.addRequestHeader("Accept", "application/json");</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; int result = httpClient.executeMethod(post);</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println("Response status code: " + result);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println("Response body: ");</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println(post.getResponseBodyAsString());</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; } catch (HttpException e) {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; e.printStackTrace();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; } catch (IOException e) {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; e.printStackTrace();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; } finally {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; post.releaseConnection();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Response status code: 200</p><p>Response body: </p><p>&lt;html&gt;</p><p>&lt;head&gt;</p><p>&#160; &lt;title&gt;HTTP 401&lt;/title&gt; &lt;!-- Do not remove --&gt;</p><p>&lt;/head&gt;</p><p>&lt;body&gt;</p><p>&lt;form method="POST" action="j_security_check"&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160; &lt;center/&gt;</p><p>&#160; &lt;br&gt;&lt;br&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160; &lt;div style="font-family:sans-serif;border:1px solid black; width:270;padding:15px;"&gt;</p><p>&#160;&#160;&#160; &lt;h2&gt;BPM Console Server&lt;/h2&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; &lt;table with=250&gt;</p><p>&#160;&#160;&#160; &lt;tr&gt;</p><p>&#160;&#160;&#160;&#160;&#160; &lt;td&gt;Username:&lt;/td&gt;</p><p>&#160;&#160;&#160;&#160;&#160; &lt;td&gt;&lt;input type="text" name="j_username"&gt;&lt;/td&gt;</p><p>&#160;&#160;&#160; &lt;/tr&gt;</p><p>&#160;&#160;&#160; &lt;tr&gt;</p><p>&#160;&#160;&#160;&#160;&#160; &lt;td&gt;Password:&lt;/td&gt;</p><p>&#160;&#160;&#160;&#160;&#160; &lt;td&gt;&lt;input type="password" name="j_password"&gt;&lt;/td&gt;</p><p>&#160;&#160;&#160; &lt;/tr&gt;</p><p>&#160;&#160;&#160; &lt;tr&gt;</p><p>&#160;&#160;&#160;&#160;&#160; &lt;td&gt;&lt;/td&gt;</p><p>&#160;&#160;&#160;&#160;&#160; &lt;td align=right&gt;&lt;input type="submit"/&gt;&lt;/td&gt;</p><p>&#160;&#160;&#160; &lt;/tr&gt;</p><p>&#160; &lt;/table&gt;</p><p>&#160; &lt;/div&gt;</p><p>&lt;/form&gt;</p><p>&lt;/body&gt;</p><p>&lt;/html&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Can any one help me out on this, what I need to do to start a new process instance by calling rest url.</p><p>Thanks a lot in advance</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Thanks,</p><p>Satish.</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/600525#600525">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>