Document pureRequest = SoapTools.unwrapMessage(userProcessRequest);
Element rootElement = pureRequest.getRootElement();
String rootElementName = rootElement.getName();
IDispatcher dispatcher = null;
try {
dispatcher = Dispatchers.createDispatcher(rootElementName);
} catch (NoDispatcherException e) {
_log.debug("No custom dispatcher, using the default processing");
}
if (dispatcher != null) {
// TODO: convert the default processing to an IDispatcher
try {
Document processedRequest = dispatcher.dispatchRequest(pureRequest);
Document wrappedRequest = SoapTools.wrapMessage(processedRequest);
String endpoint = dispatcher.getTargetEndpoint();
String dispatcherSoapAction = dispatcher.getTargetSoapAction();
Document rawResponse = messageSender.requestAndGetReply(wrappedRequest, endpoint, dispatcherSoapAction);
Document unwrappedResponse = SoapTools.unwrapMessage(rawResponse);
Document processedResponse = dispatcher.dispatchResponse(unwrappedResponse);
responseDocument = SoapTools.wrapMessage(processedResponse);
} catch (InvalidInputFormatException e) {
_log.error("Error converting user process request", e);
// TODO: return a SOAP fault
throw new RuntimeException(e);