I have successfully installed activiti for dev environment.We use activiti-rest in our application.But now whenever I try to start a simple process I am getting "Bad Request (400) - Bad Request".Here is my code …
public static ClientResource getClientResource(String uri,String userName,String password) {
System.out.println("in getClientResource password:"+password);
ClientResource clientResource = new ClientResource(uri);
clientResource.setChallengeResponse(ChallengeScheme.HTTP_BASIC,userName, password);
return clientResource;
}
public static String startRequestedProcess(HashMap<String,Object> param,String userName,String password)
throws Exception {
String uri = "http://localhost:9090/activiti-rest/service/runtime/process-instances";
JSONObject object=new JSONObject();
Set s=param.keySet();
Iterator<String> itr= s.iterator();
while(itr.hasNext())
{
String key=itr.next();
object.put(key, param.get(key));
System.out.println(key +" "+param.get(key));
}
Representation rep = new JsonRepresentation(object);
rep.setMediaType(MediaType.APPLICATION_JSON);
JSONObject jsObj = new JSONObject(getClientResource(uri,userName,password).post(rep).getText());
logger.info("Returning processId " + jsObj.getString("id"));
return jsObj.getString("id");
}
public static void main(String args[]) throws Exception{
try{
HashMap<String, Object> param = new HashMap<>();
param.put("processDefinitionKey", "testRestProcess");
startRequestedProcess(param,"caadmin","P@ssw0rd");
}catch(ResourceException e){
System.out.println("===== > "+e.getMessage());
System.out.println("===== >"+e.getStatus());
}
is something wrong in my code??