使用java代码在activiti-rest中部署流程定义时出错

时间:2016-07-29 13:43:37

标签: rest alfresco activiti

大家好我正试图通过使用java rest在活动休息中部署进程定义。但是在线程"主要"中得到错误'异常错误的请求(400)'。我在谷歌尝试了很多,但没有找到任何解决方案。请帮助我在我的代码中的实际错误。找到我的java代码和错误。

我的错误



  
Starting the internal HTTP client
Exception in thread "main" Bad Request (400) - The request could not be understood by the server due to malformed syntax
	at org.restlet.resource.ClientResource.doError(ClientResource.java:590)
	at org.restlet.resource.ClientResource.handleInbound(ClientResource.java:1153)
	at org.restlet.resource.ClientResource.handle(ClientResource.java:1048)
	at org.restlet.resource.ClientResource.handle(ClientResource.java:1023)
	at org.restlet.resource.ClientResource.post(ClientResource.java:1485)
	at org.restlet.resource.ClientResource.post(ClientResource.java:1424)
	at com.bizruntime.activiti.rest.Activiti_Rest_BuyEconomyOrBusinsessClassTIcket.TicketClass.createdeployment(TicketClass.java:40)
	at com.bizruntime.activiti.rest.Activiti_Rest_BuyEconomyOrBusinsessClassTIcket.Ticke_Test.main(Ticke_Test.java:13)



 我的Java代码



/**
*Client Resource
*/
private static ClientResource getClientResource(String uri){
	ClientResource resource=new ClientResource("http://localhost:8431/activiti-rest/service");
	resource.setChallengeResponse(ChallengeScheme.HTTP_BASIC,kermit,kermit);
	return resource;
}

/**
 * Creating Deployment
 */
public static JSONObject createdeployment(){
	String uri=REST_URI+"/repository/deployments";
	log.debug("uri(Create Deploymnet):: "+uri);
	JSONObject my_data=new JSONObject();
	try {
		my_data.put("name","BuyTicket.bpmn20.xml");
		Representation response=getClientResource(uri).post(my_data);
		JSONObject object=new JSONObject(response.getText());
		if(object!=null){
		  log.info("Deployed Successfully.....");
		  return object;
		}
		
	} catch (JSONException e) {
		e.printStackTrace();
	} catch (IOException e) {
		e.printStackTrace();
	}
	return null;
}




1 个答案:

答案 0 :(得分:1)

(CFR)。 http://activiti.org/userguide/index.html#_create_a_new_deployment:正文不应该是bson多部分/表单数据文件,它是bpmn20.xml文件(如果是多个文件,则为.zip)