String tracingTag = tracingTagExpression.valueOf(completeWorkitemRequest);
List elementProcessVariableList = completeWorkitemRequest.getChildren("processVariable", WORKFLOW_NAMESPACE);
HashMap processVariableMap = ElementToObject.makeProcessVariableMap(elementProcessVariableList);
ProcessManagerFactoryBean processManagerFactory = new ProcessManagerFactoryBean();
ProcessManagerRemote pm = null;
InitialContext context = new InitialContext();
UserTransaction tx = (GlobalContext.useManagedTransaction ? (UserTransaction) context.lookup(GlobalContext.USERTRANSACTION_JNDI_NAME) : null);
String completedTaskId = null;
List nextTaskList = null;
try {
pm = processManagerFactory.getProcessManager();
if (tx != null)
tx.begin();
completedTaskId = workflowService.completeWorkitem(endpoint, instanceId, taskId, tracingTag, processVariableMap, pm);