* already been partly processed and therefore should be assumed
* to be corrupted.
*/
@SuppressWarnings("unchecked")
public void convertMessage(Document message) throws MessageFormatException, AxisFault {
FormDispatcherConfiguration config = FormDispatcherConfiguration.getInstance();
XPath xpath = null;
xpath = DocumentHelper.createXPath("/soapenv:Envelope/soapenv:Body/soapenv:Fault");
List<Node> fault = xpath.selectNodes(message);
if (fault.size() != 0)
throw new RuntimeException(fault.toString());
// Check SOAP action
xpath = DocumentHelper.createXPath("/soapenv:Envelope/soapenv:Body");
xpath.setNamespaceURIs(MessageConstants.get_nsMap());
List<Node> bodyQueryResult = xpath.selectNodes(message);
if (bodyQueryResult.size() != 0) {
Element root = (Element) bodyQueryResult.get(0);
if (root.asXML().indexOf("createTaskRequest") != -1) {
_soapAction = "createTask";
xpath = DocumentHelper.createXPath("/soapenv:Envelope/soapenv:Header/addr:Action");
xpath.setNamespaceURIs(MessageConstants.get_nsMap());
List<Node> wsaActionQueryResult = xpath.selectNodes(message);
if (wsaActionQueryResult.size() != 0) {
Element wsaToElement = (Element) wsaActionQueryResult.get(0);
wsaToElement.setText(_soapAction);
} else
_log.warn("Did not find addr:Action in SOAP header");
}
}
_log.debug("Converted SOAP Action: " + _soapAction);
/*
* Change the wsa:To endpoint to Workflow Processes, if a wsa:To header
* is present.
*/
xpath = DocumentHelper.createXPath("/soapenv:Envelope/soapenv:Header/addr:To");
xpath.setNamespaceURIs(MessageConstants.get_nsMap());
List<Node> wsaToQueryResult = xpath.selectNodes(message);
if (wsaToQueryResult.size() != 0) {
Element wsaToElement = (Element) wsaToQueryResult.get(0);
String workflowProcessesUrl = config.getPxeBaseUrl() + config.getWorkflowProcessesRelativeUrl();
wsaToElement.setText(workflowProcessesUrl);
} else
_log.debug("Did not find addr:To in SOAP header");
/*
* Change the session address to be FDS endpoint and retrieve sender
* endpoint
*/
xpath = DocumentHelper.createXPath("/soapenv:Envelope/soapenv:Header/intalio:callback/addr:Address");
xpath.setNamespaceURIs(MessageConstants.get_nsMap());
List<Node> callbackToQueryResult = xpath.selectNodes(message);
if (callbackToQueryResult.size() != 0) {
Element wsaToElement = (Element) callbackToQueryResult.get(0);
_userProcessEndpoint = wsaToElement.getText();
wsaToElement.setText(config.getFdsUrl());
} else
_log.debug("Did not find intalio:callback/addr:Address in SOAP header");
/* Next, fetch the user process namespace URI from the task metadata */
/*