log.debug("BEGIN handleRequest: " + ep.getName());
beginProcessing = initRequestMetrics(ep);
MimeHeaders headers = (headerSource != null ? headerSource.getMimeHeaders() : null);
MessageAbstraction reqMessage;
String bindingID = sepMetaData.getBindingId();
if (HTTPBinding.HTTP_BINDING.equals(bindingID))
{
reqMessage = new HTTPMessageImpl(headers, inputStream);
}
else
{
msgFactory.setServiceMode(sepMetaData.getServiceMode());
msgFactory.setStyle(sepMetaData.getStyle());
reqMessage = (SOAPMessageImpl)msgFactory.createMessage(headers, inputStream);
}
// Associate current message with message context
msgContext.setMessageAbstraction(reqMessage);
// debug the incomming message
MessageTrace.traceMessage("Incoming Request Message", reqMessage);
// Set the thread context class loader
ClassLoader classLoader = sepMetaData.getClassLoader();
Thread.currentThread().setContextClassLoader(classLoader);
// Get the Invoker
ServiceEndpointInvoker epInvoker = ep.getAttachment(ServiceEndpointInvoker.class);
if (epInvoker == null)
throw new IllegalStateException("Cannot obtain ServiceEndpointInvoker");
// Invoke the service endpoint
epInvoker.invoke(reqContext);
// Get the response message context
msgContext = MessageContextAssociation.peekMessageContext();
// Get the response message
MessageAbstraction resMessage = msgContext.getMessageAbstraction();
if (resMessage != null)
postProcessResponse(headerSource, resMessage);
return resMessage;
}
catch (Exception ex)
{
MessageAbstraction resMessage = MessageContextAssociation.peekMessageContext().getMessageAbstraction();
// In case we have an exception before the invoker is called
// we create the fault message here.
if (resMessage == null || resMessage.isFaultMessage() == false)
{
CommonBindingProvider bindingProvider = new CommonBindingProvider(sepMetaData);
CommonBinding binding = bindingProvider.getCommonBinding();
resMessage = binding.bindFaultMessage(ex);
}
if (resMessage != null)
postProcessResponse(headerSource, resMessage);
return resMessage;
}
finally
{
try
{
MessageAbstraction resMessage = MessageContextAssociation.peekMessageContext().getMessageAbstraction();
if (resMessage != null)
{
if (resMessage.isFaultMessage())
{
processFaultMetrics(ep, beginProcessing);
}
else
{