Dear ,
Below is the REST client to invoke the Camunda DMN API.
@RequestMapping(value = “/testRest” , method = RequestMethod.POST)
public String testRest(@RequestBody Map<String, Object> request) {
try {
System.out.println( "request "+request);
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
headers.setContentType(MediaType.APPLICATION_JSON);
ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
String requestJson = ow.writeValueAsString(request);
HttpEntity<String> entity = new HttpEntity<>(requestJson, headers);
System.out.println( "entity "+entity);
final SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setTaskExecutor(new SimpleAsyncTaskExecutor());
requestFactory.setConnectTimeout(30000);
requestFactory.setReadTimeout(30000);
Class<Object> objectClass = Object.class;
final AsyncRestTemplate asyncRestTemplate = new AsyncRestTemplate();
asyncRestTemplate.setAsyncRequestFactory(requestFactory);
ListenableFuture<ResponseEntity<Object>> response = asyncRestTemplate.exchange("http://localhost:8080/rest/engine/default/decision-definition/key/declaration/evaluate", HttpMethod.POST, entity, objectClass);
System.out.println( "response "+response);
return response.toString();
} catch (JsonProcessingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
and input from Post man is below.
{
“regime”: “import”,
“declarationType”: “import”,
“partyType”: “commercial”,
“totalcharge”: “1000”,
“itemRequestDTOs”: [
{
“hscode”:“10101010”,
“description”:“test1”,
“hscodeCOO” :“UAE”
},
{
“hscode”:“20202020”,
“description”:“test2”,
“hscodeCOO” :“IND”
}
],
“invoiceDTOs”: [
{
“invoiceNumber”:“12345”,
“invoiceType”:“CIP”
},
{
“invoiceNumber”:“123456”,
“invoiceType”:“CIF”
}
]
}
But i m getting below Error,
Caused by: org.camunda.bpm.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier ‘regime’
at org.camunda.bpm.engine.impl.juel.AstIdentifier.eval(AstIdentifier.java:83)
at org.camunda.bpm.engine.impl.juel.AstEval.eval(AstEval.java:50)
at org.camunda.bpm.engine.impl.juel.AstNode.getValue(AstNode.java:26)
at org.camunda.bpm.engine.impl.juel.TreeValueExpression.getValue(TreeValueExpression.java:114)
at org.camunda.bpm.engine.impl.dmn.el.ProcessEngineElExpression.getValue(ProcessEngineElExpression.java:46)
at org.camunda.bpm.dmn.engine.impl.evaluation.ExpressionEvaluationHandler.evaluateElExpression(ExpressionEvaluationHandler.java:120)
… 97 common frames omitted
But in the DMN file having this property.
Thanks
Vemula