issue with rest-get connector when status is 204 or 404 or... (empty body)

1
+1
-1

Hi,

We have a process where we are calling a web service with a GET method.

When the response is 204, or 404 and the body is empty, it breaks with an exception in the script. It seems to be in any cases when we are importing the bodyAsObject connector output in a script.

we get this stacktrace:

org.bonitasoft.engine.core.connector.exception.SConnectorException: PROCESS_DEFINITION_ID=5711209466255545438 | PROCESS_NAME=XXXXXXXXXXXX | PROCESS_VERSION=1.0 | PROCESS_INSTANCE_ID=2064 | ROOT_PROCESS_INSTANCE_ID=2064 | FLOW_NODE_DEFINITION_ID=6247473910900401100 | FLOW_NODE_INSTANCE_ID=40347 | FLOW_NODE_NAME=xxxxxxxxxxxxxxxxxxxxxxxxxx | CONNECTOR_IMPLEMENTATION_CLASS_NAME=xxxxxxxxxxxxxxxxxx | CONNECTOR_INSTANCE_ID=40138 | org.bonitasoft.engine.core.operation.exception.SOperationExecutionException: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: No value found for mandatory expression 'bodyAsObject' of type Input Expression<br />
    at org.bonitasoft.engine.core.connector.impl.ConnectorServiceImpl.executeOutputOperation(ConnectorServiceImpl.java:191)<br />
    at org.bonitasoft.engine.connector.ConnectorServiceDecorator.executeOutputOperation(ConnectorServiceDecorator.java:108)<br />
    at org.bonitasoft.engine.execution.work.ExecuteConnectorWork.evaluateOutput(ExecuteConnectorWork.java:125)<br />
    at org.bonitasoft.engine.execution.work.ExecuteConnectorOfActivity.evaluateOutput(ExecuteConnectorOfActivity.java:77)<br />
    at org.bonitasoft.engine.execution.work.ExecuteConnectorWork$EvaluateConnectorOutputsTxContent.call(ExecuteConnectorWork.java:333)<br />
    at org.bonitasoft.engine.execution.work.ExecuteConnectorWork$EvaluateConnectorOutputsTxContent.call(ExecuteConnectorWork.java:1)<br />
    at org.bonitasoft.engine.transaction.JTATransactionServiceImpl.executeInTransaction(JTATransactionServiceImpl.java:274)<br />
    at org.bonitasoft.engine.execution.work.ExecuteConnectorWork.work(ExecuteConnectorWork.java:158)<br />
    at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)<br />
    at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)<br />
    at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)<br />
    at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)<br />
    at org.bonitasoft.engine.execution.work.InSessionBonitaWork.work(InSessionBonitaWork.java:58)<br />
    at org.bonitasoft.engine.work.BonitaThreadPoolExecutor.lambda$submit$0(BonitaThreadPoolExecutor.java:90)<br />
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)<br />
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)<br />
    at java.lang.Thread.run(Thread.java:745)<br />
Caused by: org.bonitasoft.engine.core.operation.exception.SOperationExecutionException: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: No value found for mandatory expression 'bodyAsObject' of type Input Expression<br />
    at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.evaluateRightOperandExpression(OperationServiceImpl.java:203)<br />
    at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.calculateRightOperandValue(OperationServiceImpl.java:121)<br />
    at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.executeOperators(OperationServiceImpl.java:106)<br />
    at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.execute(OperationServiceImpl.java:95)<br />
    at org.bonitasoft.engine.core.connector.impl.ConnectorServiceImpl.executeOutputOperation(ConnectorServiceImpl.java:188)<br />
    ... 16 more<br />
Caused by: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: No value found for mandatory expression 'bodyAsObject' of type Input Expression<br />
    at org.bonitasoft.engine.expression.impl.InputExpressionExecutorStrategy.evaluate(InputExpressionExecutorStrategy.java:44)<br />
    at org.bonitasoft.engine.expression.impl.InputExpressionExecutorStrategy.evaluate(InputExpressionExecutorStrategy.java:57)<br />
    at org.bonitasoft.engine.expression.impl.ExpressionServiceImpl.evaluate(ExpressionServiceImpl.java:141)<br />
    at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionsOfKind(ExpressionResolverServiceImpl.java:225)<br />
    at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateAllExpressionsWithNoDependencies(ExpressionResolverServiceImpl.java:182)<br />
    at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionsFlatten(ExpressionResolverServiceImpl.java:115)<br />
    at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluate(ExpressionResolverServiceImpl.java:83)<br />
    at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.evaluateRightOperandExpression(OperationServiceImpl.java:198)<br />
    ... 20 more<br />
 

Is this normal and expected? Is there any way around this?

We tried testing for the response_code value before accessing this variable but it still breaks.

Thanks,

Mahboob

1 answer

1
0
-1

In fact if a GET request return 204 I would excepect the bodyAsObject to be null but to raised the error: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: No value found for mandatory expression 'bodyAsObject' of type Input Expression

Could you open a bug report on https://bonita.atlassian.net/projects/BBPMC ?

Thanks

Notifications