dao.close();
}
}
public OMElement initProcess(final OMElement requestElement) throws AxisFault {
ITaskDAOConnection dao=null;
try {
dao=_taskDAOFactory.openConnection();
OMElementQueue rootQueue = new OMElementQueue(requestElement);
String taskID = requireElementValue(rootQueue, "taskId");
OMElement omInputContainer = requireElement(rootQueue, "input");
Document domInput = null;
if (omInputContainer.getFirstElement() != null) {
domInput = new TaskUnmarshaller().unmarshalTaskOutput(omInputContainer);
}
final String participantToken = requireElementValue(rootQueue, "participantToken");
final UserRoles ur = _server.getUserRoles(participantToken);
final String user = ur.getUserID();
final String formUrl = expectElementValue(rootQueue, "formUrl");
Document userProcessResponse = _server.initProcess(dao,taskID, user, formUrl, domInput, participantToken);
if (userProcessResponse == null)
throw new RuntimeException("TMP did not return a correct message while calling init");
OMElement response = new TMSResponseMarshaller(OM_FACTORY) {
public OMElement marshalResponse(Document userProcessResponse) {
OMElement response = createElement("initProcessResponse");
OMElement userProcessResponseWrapper = createElement(response, "userProcessResponse");
userProcessResponseWrapper.addChild(new XmlTooling().convertDOMToOM(userProcessResponse, this.getOMFactory()));
return response;
}
}.marshalResponse(userProcessResponse);
return response;
} catch (Exception e) {
throw makeFault(e);
}
finally{
if(dao!=null)
dao.close();
}
}