<!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="https://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;">
jBPM 5.4 : Signal Event and VariableName
</h3>
<span style="margin-bottom: 10px;">
created by <a href="https://community.jboss.org/people/wishmaster7">wishmaster7</a> in <i>jBPM</i> - <a href="https://community.jboss.org/message/795177#795177">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 all,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I am a beginner with jBPM and I need some help with the signal event; all I have found in the documentation (and in the web chat) is something like :</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">VariableName: The name of the variable that will contain the data associated with this event (if any) when this event occurs.</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>And this doesn't help much...</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>So I have created a basic example with a start node, then a AND gateway which waits for the signal event. I'm working with jBPM REST webservices; first I call :</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="padding-left: 30px;">POST: <span style="font-family: courier new,courier; font-size: 8pt;"><a class="jive-link-external-small" href="http://localhost:8080/gwt-console-server/rs/process/definition/myProcess/new_instance" rel="nofollow" target="_blank">http://localhost:8080/gwt-console-server/rs/process/definition/myProcess/new_instance</a></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>and in the json return, I get the process instance id (in this example: 57). Then I call :</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="padding-left: 30px;">POST: <span style="font-size: 8pt; font-family: courier new,courier;"><a class="jive-link-external-small" href="http://localhost:8080/gwt-console-server/rs/process/tokens/57/transition?signal=receiveInitData" rel="nofollow" target="_blank">http://localhost:8080/gwt-console-server/rs/process/tokens/57/transition?signal=receiveInitData</a></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>and this pefectly triggers the signal event. But I want to pass parameters, and I think the "VariableName" of the signal event is suitable for that. So I have the "woId" variable, but its value is always null.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Here is, in my Java application, the code I use to call the POST webservice:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">private String requestPostService() throws Exception {</span></p><p style="padding-left: 90px;"></p><p style="padding-left: 90px;"><span style="font-family: courier new,courier; font-size: 8pt;">String url = </span><br/><span style="font-size: 8pt; font-family: courier new,courier;"><span>"</span><a class="jive-link-external-small" href="http://localhost:8080/gwt-console-server/rs/process/tokens/57/transition?signal=receiveInitData" rel="nofollow" target="_blank">http://localhost:8080/gwt-console-server/rs/process/tokens/57/transition?signal=receiveInitData</a><span>";</span></span><br/></p><p style="padding-left: 60px;"><span style="font-family: courier new,courier; font-size: 8pt;">    </span></p><p style="padding-left: 60px;"><span style="font-family: courier new,courier; font-size: 8pt;">    </span><span style="font-family: courier new,courier; font-size: 8pt;">// here is my map with the parameter I want to pass to the jBPM process</span></p><p style="padding-left: 60px;"><span style="font-family: courier new,courier; font-size: 8pt;">    List<NameValuePair> formparams = new ArrayList<NameValuePair>();</span><br/><span style="font-family: courier new,courier; font-size: 8pt;">    formparams.add(new BasicNameValuePair("woId", "testValue"));</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">        HttpPost httpPost = new HttpPost(url);</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">        UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8");</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">        httpPost.setEntity(entity);</span><br/><span style="font-family: courier new,courier; font-size: 8pt;">        HttpClient httpClient = new DefaultHttpClient();</span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">        HttpResponse response = httpClient.execute(httpPost);</span></p><p style="padding-left: 60px;"><span style="font-family: courier new,courier; font-size: 8pt;">   // the getRequestString() method is parsing the response<br/></span></p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">        return this.getRequestString(response);</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="padding-left: 30px;"><span style="font-family: courier new,courier; font-size: 8pt;">    }</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>And in attachement, the process BPMN file.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I don't know what is missing; in the console, it's printing:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="padding-left: 30px;"><span style="font-size: 8pt; font-family: courier new,courier;">Init data...</span></p><p style="padding-left: 30px;"><span style="font-size: 8pt; font-family: courier new,courier;">null<br/></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>"Init data" is the string called in "Init Data" task; null is the value of my variable.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Someone has an idea?</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/795177#795177">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="https://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>