jBPM客户端API不将参数传递给引擎

时间:2015-02-19 03:57:38

标签: rest jbpm

我在WildFly 8.1上设置了jBPM 6.1.0.Final。我能够成功执行功能。

现在我正在尝试将工作流引擎集成到另一个应用程序中。

我有以下代码来测试它是否有效

//Complete a task
        private void completeTask(String taskId) {
               restCall = url + "/rest/task/" + taskId + "/complete";

          try {
          httppost = new HttpPost(restCall);
          authorizationHeader = scheme.authenticate(credentials, httppost);
          httppost.addHeader(authorizationHeader);
          HttpParams params = new BasicHttpParams();
          params.setParameter("map_vLobHeadComments", "Approved");
          httppost.setParams(params);
          response = httpclient.execute(httppost);

          if (response != null) {
              System.out.println("Task complete Response status line: "+ response.getStatusLine());
               if (response.getStatusLine() != null) {
                   System.out.println("Task complete Response status code: "+ response.getStatusLine().getStatusCode());
               }
          }
          } catch (ClientProtocolException ex) {
               ex.printStackTrace();
          } catch (Exception ex) {
               ex.printStackTrace();
          } finally {
               closeHttpClient();
          }
          }

不幸的是,参数没有传递给jBPM引擎。 请帮帮我

由于

2 个答案:

答案 0 :(得分:0)

尝试自己做其余的调用似乎不是实现这一目标的可靠方法。您可能需要查看Remoting API。我还没有使用Remoting API,但我认为这是你想要的路线。

答案 1 :(得分:0)

替换这些行:

 HttpParams params = new BasicHttpParams();
 params.setParameter("map_vLobHeadComments", "Approved");
 httppost.setParams(params);

用这些:

URIBuilder uri = new URIBuilder(httpPostCall.getURI());
uri.addParameter("map_vLobHeadComments", "Approved");
((HttpRequestBase) httppost ).setURI(uri.build());

这适用于对JBPM REST API的所有POST调用。