We are trying to write Spring RestTemplate client for Activiti REST's Create Deployment service to deploy our BPMN. Any ready code in Spring RestTemplate would be really helpful.
I'm trying below example but it is throwing 400 BAD Request -
JSONObject obj = new JSONObject(e.getResponseBodyAsString());
System.out.println(obj); }
if (!Objects.isNull(responseEntity) && !Objects.isNull(responseEntity.getBody())) { System.out.println("Deployment Done with deployment ID – " + responseEntity.getBody().getId()); }
}
public static void main(String[] args) { new ActivitiRESTDeployerSpring1().deploy();
}
public SimpleClientHttpRequestFactory getAuthenticatedHeader() { SimpleClientHttpRequestFactory connectionFactory = new SimpleClientHttpRequestFactory() { @Override protected void prepareConnection(final HttpURLConnection connection, final String httpMethod) throws IOException { super.prepareConnection(connection, httpMethod); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON);
We have unit tests that deploy process definitions to the Activiti Engine via a REST service, so maybe that's a good place to look for some code examples.