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:

  1. 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 />
  2. at org.bonitasoft.engine.core.connector.impl.ConnectorServiceImpl.executeOutputOperation(ConnectorServiceImpl.java:191)<br />
  3. at org.bonitasoft.engine.connector.ConnectorServiceDecorator.executeOutputOperation(ConnectorServiceDecorator.java:108)<br />
  4. at org.bonitasoft.engine.execution.work.ExecuteConnectorWork.evaluateOutput(ExecuteConnectorWork.java:125)<br />
  5. at org.bonitasoft.engine.execution.work.ExecuteConnectorOfActivity.evaluateOutput(ExecuteConnectorOfActivity.java:77)<br />
  6. at org.bonitasoft.engine.execution.work.ExecuteConnectorWork$EvaluateConnectorOutputsTxContent.call(ExecuteConnectorWork.java:333)<br />
  7. at org.bonitasoft.engine.execution.work.ExecuteConnectorWork$EvaluateConnectorOutputsTxContent.call(ExecuteConnectorWork.java:1)<br />
  8. at org.bonitasoft.engine.transaction.JTATransactionServiceImpl.executeInTransaction(JTATransactionServiceImpl.java:274)<br />
  9. at org.bonitasoft.engine.execution.work.ExecuteConnectorWork.work(ExecuteConnectorWork.java:158)<br />
  10. at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)<br />
  11. at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)<br />
  12. at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)<br />
  13. at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)<br />
  14. at org.bonitasoft.engine.execution.work.InSessionBonitaWork.work(InSessionBonitaWork.java:58)<br />
  15. at org.bonitasoft.engine.work.BonitaThreadPoolExecutor.lambda$submit$0(BonitaThreadPoolExecutor.java:90)<br />
  16. at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)<br />
  17. at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)<br />
  18. at java.lang.Thread.run(Thread.java:745)<br />
  19. 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 />
  20. at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.evaluateRightOperandExpression(OperationServiceImpl.java:203)<br />
  21. at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.calculateRightOperandValue(OperationServiceImpl.java:121)<br />
  22. at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.executeOperators(OperationServiceImpl.java:106)<br />
  23. at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.execute(OperationServiceImpl.java:95)<br />
  24. at org.bonitasoft.engine.core.connector.impl.ConnectorServiceImpl.executeOutputOperation(ConnectorServiceImpl.java:188)<br />
  25. ... 16 more<br />
  26. Caused by: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: No value found for mandatory expression 'bodyAsObject' of type Input Expression<br />
  27. at org.bonitasoft.engine.expression.impl.InputExpressionExecutorStrategy.evaluate(InputExpressionExecutorStrategy.java:44)<br />
  28. at org.bonitasoft.engine.expression.impl.InputExpressionExecutorStrategy.evaluate(InputExpressionExecutorStrategy.java:57)<br />
  29. at org.bonitasoft.engine.expression.impl.ExpressionServiceImpl.evaluate(ExpressionServiceImpl.java:141)<br />
  30. at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionsOfKind(ExpressionResolverServiceImpl.java:225)<br />
  31. at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateAllExpressionsWithNoDependencies(ExpressionResolverServiceImpl.java:182)<br />
  32. at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionsFlatten(ExpressionResolverServiceImpl.java:115)<br />
  33. at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluate(ExpressionResolverServiceImpl.java:83)<br />
  34. at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.evaluateRightOperandExpression(OperationServiceImpl.java:198)<br />
  35. ... 20 more<br />
  36.  

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