// @javax.jws.WebMethod(exclude=true)
public final Source invoke(Source request) {
QName operationQName = (QName) context.getMessageContext().get(
MessageContext.WSDL_OPERATION);
LOG.info("Invoke operation '" + operationQName + "'");
GenericOperation esbProviderCallback =
getESBProviderCallback(operationQName.getLocalPart());
if (esbProviderCallback == null) {
throw new RuntimeException("Handler for operation "
+ operationQName + " cannot be found");
}
try {
ByteArrayOutputStream os = new java.io.ByteArrayOutputStream();
StaxUtils.copy(request, os);
org.dom4j.Document requestDoc = new SAXReader()
.read(new ByteArrayInputStream(os.toByteArray()));
Object payload;
if (extractHeaders) {
Map<String, Object> esbRequest = new HashMap<String, Object>();
esbRequest.put(ESBProviderCallback.HEADERS_SOAP, context.getMessageContext().get(Header.HEADER_LIST));
esbRequest.put(ESBProviderCallback.HEADERS_HTTP, context.getMessageContext().get(MessageContext.HTTP_REQUEST_HEADERS));
esbRequest.put(ESBProviderCallback.REQUEST, requestDoc);
esbRequest.put(CorrelationIDFeature.MESSAGE_CORRELATION_ID, context.getMessageContext().get(CorrelationIDFeature.MESSAGE_CORRELATION_ID));
payload = esbRequest;
} else {
payload = requestDoc;
}
Object result = esbProviderCallback.invoke(payload,
isOperationRequestResponse(operationQName.getLocalPart()));
// oneway
if (result == null) {
return null;