Passing complex objects via REST to evaluate decision


#1

I asked about using complex objects in decision evaluation quiote some while ago: https://groups.google.com/forum/#!topic/camunda-bpm-users/jZ6jLvRupCY. Sebastian Menski answered with this working example: https://github.com/menski/dmn-rest-complex-object. I finally had some time to investiagte, as I needed this again today :slight_smile:

I found the difference: I want to do the same WITHOUT using a BPMN process instance.

I used tis request with the example from Sebastian:

POST http://localhost:8080/engine-rest/decision-definition/key/testDecision/evaluate
{
    "variables": {
        "claim": {
            "type": "Object", 
            "value": "{\"type\":\"Unfall\"}", 
            "valueInfo": {
                "objectTypeName": "org.camunda.bpm.example.Claim", 
                "serializationDataFormat": "application/json"
            }
        }
    }
}

This does not work

Caused by: java.lang.IllegalStateException: Object is not deserialized.
        at org.camunda.bpm.engine.variable.impl.value.ObjectValueImpl.getValue(ObjectValueImpl.java:86)
        at org.camunda.bpm.engine.impl.el.VariableContextElResolver.unpack(VariableContextElResolver.java:73)
        at org.camunda.bpm.engine.impl.el.VariableContextElResolver.getValue(VariableContextElResolver.java:42)
        at org.camunda.bpm.engine.impl.javax.el.CompositeELResolver.getValue(CompositeELResolver.java:231)
        at org.camunda.bpm.engine.impl.juel.AstIdentifier.eval(AstIdentifier.java:81)
        at org.camunda.bpm.engine.impl.juel.AstProperty.eval(AstProperty.java:52)
        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:43)
        at org.camunda.bpm.dmn.engine.impl.evaluation.ExpressionEvaluationHandler.evaluateElExpression(ExpressionEvaluationHandler.java:118)
        ... 89 more

I tried to hand in some JSON comparable to How can pass multiple values to input variable in request body - but this seems not to be possible without adjusting my personal DMN where JUEL is used to access a Java object.

Might be that we are missing a context switch when evaluting DMN?


#2

Hi Bernd,

it seems to be a bug, I created the issue CAM-7004. I also debugged into this and there is a context switch. Nevertheless the variable is never deserialized, not sure why.

Cheers,
Sebastian


#3

You are right - I thought about this tonight as my daugther couldn’t sleep: I could reproduce it on Spring Boot where i definitely have the class in the classpath. So yes - seems to be a bug. Thanks for creating it!


#5

I think this is a different problem. Could you open a separate thread please?


#6

Hi,
we are running into the same error, trying to send a complex data object via REST to the DMN for evaluation. We are using Camunda 7.10.0, is the bug still in this version?

Regards
Edmund


#7

The issue is unresolved in JIRA, and as you also see the issue I would say it still exists :frowning:


#8

Yes, I’m getting the same error when attempting to pass in a complex data object via REST for evaluation in a DMN