Error evaluating EL expression


I’m trying to configure an http connector to send a small json to a SoapUI mock rest service, e.g. { "errorCode" : -1}
So in Modeler I put {"errorCode":${errorCode.toString()}} to build the payload string from the process variable. The resulting xml fragment in bpmn file is

<camunda:inputParameter name="payload"><![CDATA[{"errorCode":${errorCode.toString()}}]]></camunda:inputParameter>

Anyway, when I run the process I see the exception in SoapUI log

Tue Apr 19 15:43:10 CEST 2016:ERROR:java.lang.IllegalArgumentException: Invalid JSON: {"errorCode":${errorCode.toString()}}

Curly brackets seem to confuse the EL parser because the expression isn’t evaluated and is sent as literal. Anyway, the following snippet works fine:

package it.mytria.bpm.camunda.tutorial;

import org.camunda.bpm.engine.impl.javax.el.ExpressionFactory;
import org.camunda.bpm.engine.impl.javax.el.ValueExpression;
import org.camunda.bpm.engine.impl.juel.ExpressionFactoryImpl;
import org.camunda.bpm.engine.impl.juel.SimpleContext;

public class ExpressionTest {

    public static void main(String[] args) {
        ExpressionFactory factory = new ExpressionFactoryImpl();
        SimpleContext context = new SimpleContext();
        context.setVariable("errorCode", factory.createValueExpression(-1, int.class));
        ValueExpression expr = factory.createValueExpression(context, "{\"errorCode\":${errorCode.toString()}}", Object.class);


If I put the simpler expression ${errorCode.toString()} to build the payload, then this gets correctly parsed and SoapUI receives -1 as expected.

Any suggestion?

Thanks in advance,

Hi @michele_d,

That is the same problem as described here:

As a workaround, you could for example use a script to compute the input value.