JBoss Community

jBPM 5.4 : Signal Event and VariableName

created by wishmaster7 in jBPM - View the full discussion

Hi all,

 

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 :

 

VariableName: The name of the variable that will contain the data associated with this event (if any) when this event occurs.

 

And this doesn't help much...

 

 

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 :

 

POST: http://localhost:8080/gwt-console-server/rs/process/definition/myProcess/new_instance

 

and in the json return, I get the process instance id (in this example: 57). Then I call :

 

POST: http://localhost:8080/gwt-console-server/rs/process/tokens/57/transition?signal=receiveInitData

 

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.

 

 

 

Here is, in my Java application, the code I use to call the POST webservice:

 

private String requestPostService() throws Exception {

String url =
"http://localhost:8080/gwt-console-server/rs/process/tokens/57/transition?signal=receiveInitData";

   

    // here is my map with the parameter I want to pass to the jBPM process

    List<NameValuePair> formparams = new ArrayList<NameValuePair>();
    formparams.add(new BasicNameValuePair("woId", "testValue"));

 

        HttpPost httpPost = new HttpPost(url);

        UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8");

        httpPost.setEntity(entity);
        HttpClient httpClient = new DefaultHttpClient();

        HttpResponse response = httpClient.execute(httpPost);

   // the getRequestString() method is parsing the response

        return this.getRequestString(response);

 

    }

 

 

And in attachement, the process BPMN file.

 

I don't know what is missing; in the console, it's printing:

 

Init data...

null

 

 

"Init data" is the string called in "Init Data" task; null is the value of my variable.

 

Someone has an idea?

Reply to this message by going to Community

Start a new discussion in jBPM at Community