Java Rest client for connect Standalone DMN

Dear,

I have 2 spring boot micro services, one micro service having application code running and another micro service running with camunda as standalone mode and deployed few DMN files.

I have used the RestTemplate to connect from one micro service to another one as below.

@RequestMapping(value = “/testRest” , method = RequestMethod.POST)
public String testRest(@RequestBody Map<String, Object> variables) {
String walletBalanceUrl = “http://localhost:8080/rest/engine/default/decision-definition/key/declaration/evaluate”;
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.set(“Content-Type”, “application/json”);
JSONObject json = new JSONObject();
for (Map.Entry<String, Object> entry : variables.entrySet()) {
json.put(entry.getKey(), entry.getValue());
}
System.out.println("json "+json);
HttpEntity httpEntity = new HttpEntity (json.toString(), httpHeaders);

	RestTemplate restTemplate = new RestTemplate();
	String response = restTemplate.postForObject(walletBalanceUrl, httpEntity, String.class);
	return response;
}

its print below log in the first microservice.
json {“declarationType”:“import”,“itemRequestDTOs”:[{“hscodeCOO”:“UAE”,“description”:“test1”,“hscode”:“10101010”},{“hscodeCOO”:“IND”,“description”:“test2”,“hscode”:“20202020”}],“regime”:“import”,“invoiceDTOs”:[{“invoiceNumber”:“12345”,“invoiceType”:“CIP”},{“invoiceNumber”:“123456”,“invoiceType”:“CIF”}],“partyType”:“commercial”,“totalcharge”:“1000”}

org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 null
at org.springframework.web.client.HttpServerErrorException.create(HttpServerErrorException.java:79) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]

and another microservice with below error.

org.camunda.bpm.engine.ProcessEngineException: Exception while evaluating decision with key ‘null’

Caused by: org.camunda.bpm.dmn.engine.impl.DmnEvaluationException: DMN-01002 Unable to evaluate expression for language ‘juel’: ‘${regime}’

But the regime is configured in my DMN file.

I m sending the input JSON object as below to 1st microservice through Postman.

{
“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 have tried to connect camunda standalone micro service through postman client with below JSON format it working fine.
{
“variables” : {
“regime”: {“value” :“import”},
“declarationType”:{“value”: “import”},
“partyType”: {“value”:“commercial”},
“declarationLines”:{“value”: [
{
“hscode”:“10101010”,
“description”:“test1”,
“hscodeCOO” :“UAE”
},
{
“hscode”:“20202020”,
“description”:“test2”,
“hscodeCOO” :“IND”
}
]},
“declarationInvoiceDocuments”:{“value”: [
{
“invoiceNumber”:“12345”,
“invoiceType”:“CIP”
},
{
“invoiceNumber”:“123456”,
“invoiceType”:“CIF”
}
]}
}
}

And given output as below.

[
{
“indicator”: {
“type”: “String”,
“value”: “Importer and Consignor (foreign supplier) are the same.”,
“valueInfo”: {}
},
“score”: {
“type”: “Double”,
“value”: 10,
“valueInfo”: {}
},
“insCaseAction”: {
“type”: “String”,
“value”: “DV/PI/SI”,
“valueInfo”: {}
},
“TRS”: {
“type”: “String”,
“value”: “Rev”,
“valueInfo”: {}
},
“rule”: {
“type”: “String”,
“value”: “Importer and Consignor (Supplier) are the same entity.”,
“valueInfo”: {}
},
“action”: {
“type”: “String”,
“value”: “Verify for non-conformance of valuation and transfer pricing regulations.”,
“valueInfo”: {}
},
“ruleOwner”: {
“type”: “String”,
“value”: “CustomsValuation”,
“valueInfo”: {}
},
“ruleId”: {
“type”: “String”,
“value”: “1”,
“valueInfo”: {}
},
“category”: {
“type”: “String”,
“value”: “Trader Risk”,
“valueInfo”: {}
},
“type”: {
“type”: “String”,
“value”: “inductive”,
“valueInfo”: {}
}
},
{
“indicator”: {
“type”: “String”,
“value”: “Importer and Consignor (foreign supplier) are the same.”,
“valueInfo”: {}
},
“score”: {
“type”: “Double”,
“value”: 20,
“valueInfo”: {}
},
“insCaseAction”: {
“type”: “String”,
“value”: “DV”,
“valueInfo”: {}
},
“TRS”: {
“type”: “String”,
“value”: “Rev”,
“valueInfo”: {}
},
“rule”: {
“type”: “String”,
“value”: “Importer and Consignor (Supplier) are the same entity.”,
“valueInfo”: {}
},
“action”: {
“type”: “String”,
“value”: “Verify for non-conformance of valuation and transfer pricing regulations.”,
“valueInfo”: {}
},
“ruleOwner”: {
“type”: “String”,
“value”: “CustomsValuation”,
“valueInfo”: {}
},
“ruleId”: {
“type”: “String”,
“value”: “2”,
“valueInfo”: {}
},
“category”: {
“type”: “String”,
“value”: “Trader Risk”,
“valueInfo”: {}
},
“type”: {
“type”: “String”,
“value”: “inductive”,
“valueInfo”: {}
}
},
{},
{}
]

Thanks
Vemula

I hope there’s a field declaration issue in your DMN. Can you upload your DMN for analysis?

declaration.dmn (11.4 KB)