[jboss-user] [jBPM] - Re: Process Parameters through REST API?
Thomas Setiabudi
do-not-reply at jboss.com
Thu Aug 9 06:28:06 EDT 2012
Thomas Setiabudi [https://community.jboss.org/people/thomas.setiabudi] created the discussion
"Re: Process Parameters through REST API?"
To view the discussion, visit: https://community.jboss.org/message/752797#752797
--------------------------------------------------------------
I though it is the problem with enctype multipart
so I altered to this:
public String instantiateDemoEvaluation(String address, String username,
String reason, String processName) {
String responseString = "";
List<NameValuePair> formparams = new ArrayList<NameValuePair>();
formparams.add(new BasicNameValuePair("employee", "thomas"));
formparams.add(new BasicNameValuePair("reason", "test"));
HttpPost httpPost = new HttpPost(" http:// http://" + "localhost:8888"
+ "/gwt-console-server/rs/form/process/" + "com.sample.evaluation"
+ "/complete");
InputStreamReader inputStreamReader = null;
BufferedReader bufferedReader = null;
try {
StringBody strUsername = new StringBody("thomas");
StringBody strReason = new StringBody("test");
MultipartEntity reqEntity = new MultipartEntity();
reqEntity.addPart("employee", strUsername);
reqEntity.addPart("reason", strReason);
httpPost.setEntity(reqEntity);
HttpResponse response = httpClient.execute(httpPost);
InputStream inputStream = response.getEntity().getContent();
inputStreamReader = new InputStreamReader(inputStream);
bufferedReader = new BufferedReader(inputStreamReader);
StringBuilder stringBuilder = new StringBuilder();
String line = bufferedReader.readLine();
while (line != null) {
stringBuilder.append(line);
line = bufferedReader.readLine();
}
responseString = stringBuilder.toString();
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
if (inputStreamReader != null) {
try {
inputStreamReader.close();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
return responseString;
}
but I got the same error as my previous post
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/752797#752797]
Start a new discussion in jBPM at Community
[https://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/20120809/61ec4567/attachment-0001.html
More information about the jboss-user
mailing list