Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

调用REST部署接口异常 #66

Open
13911391941 opened this issue Aug 8, 2017 · 0 comments
Open

调用REST部署接口异常 #66

13911391941 opened this issue Aug 8, 2017 · 0 comments

Comments

@13911391941
Copy link

调用http://localhost:8080/kft-activiti-demo/rest/repository/deployments

调用代码
public static JsonNode deploy(String fileName, InputStream fileInputStream) throws IOException {
HttpPost httpPost = new HttpPost(
SERVER_URL_PREFIX + createRelativeResourceUrl(RestUrls.URL_DEPLOYMENT_COLLECTION));
Map<String, String> additionalFormFields = new HashMap<String, String>();
additionalFormFields.put(ActivitiConstants.TENANTID, OAConstants.TENANT_ID);
httpPost.setEntity(HttpMultipartHelper.getMultiPartEntity(fileName, "application/xml", fileInputStream, null));
CloseableHttpResponse response = executeBinaryRequest(httpPost, HttpStatus.SC_CREATED);
JsonNode responseNode = new ObjectMapper().readTree(response.getEntity().getContent());
closeResponse(response);
return responseNode;
}
异常信息
Exception in thread "main" java.lang.RuntimeException: {"message":"Bad request","exception":"Multipart request is required"}
at com.asp.pt.activiti.rest.api.ActivitiHttpClient.internalExecuteRequest(ActivitiHttpClient.java:426)
at com.asp.pt.activiti.rest.api.ActivitiHttpClient.executeBinaryRequest(ActivitiHttpClient.java:411)
at com.asp.pt.activiti.rest.api.ActivitiHttpClient.deploy(ActivitiHttpClient.java:130)
at com.asp.pt.activiti.rest.api.ActivitiHttpClient.main(ActivitiHttpClient.java:84)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant