public String getProcessInstanceVariable(String containerId, Number processInstanceId, String varName, String marshallingType) { containerId = context.getContainerId(containerId, new ByProcessInstanceIdContainerLocator(processInstanceId.longValue())); Object variable = processService.getProcessInstanceVariable(containerId, processInstanceId.longValue(), varName); if (variable == null) { throw new IllegalStateException("Unable to find variable '"+ varName + "' within process instance with id " + processInstanceId); } logger.debug("About to marshal process variable with name '{}' {}", varName, variable); String response = marshallerHelper.marshal(containerId, marshallingType, variable); return response; }