throw new IllegalStateException("Cannot obtain endpoint meta data");
Type type = sepMetaData.getType();
// Build the message context
CommonMessageContext msgContext;
if (type == EndpointMetaData.Type.JAXRPC)
{
msgContext = new SOAPMessageContextJAXRPC();
invContext.addAttachment(javax.xml.rpc.handler.MessageContext.class, msgContext);
}
else
{
msgContext = new SOAPMessageContextJAXWS();
msgContext.put(MessageContextJAXWS.MESSAGE_OUTBOUND_PROPERTY, new Boolean(false));
msgContext.put(MessageContextJAXWS.INBOUND_MESSAGE_ATTACHMENTS, new HashMap<String, DataHandler>());
invContext.addAttachment(javax.xml.ws.handler.MessageContext.class, msgContext);
}
// Set servlet specific properties
HttpServletResponse httpResponse = null;
ServletHeaderSource headerSource = null;
if (invContext instanceof ServletRequestContext)
{
ServletRequestContext reqContext = (ServletRequestContext)invContext;
ServletContext servletContext = reqContext.getServletContext();
HttpServletRequest httpRequest = reqContext.getHttpServletRequest();
httpResponse = reqContext.getHttpServletResponse();
headerSource = new ServletHeaderSource(httpRequest, httpResponse);
if (type == EndpointMetaData.Type.JAXRPC)
{
msgContext.put(MessageContextJAXRPC.SERVLET_CONTEXT, servletContext);
msgContext.put(MessageContextJAXRPC.SERVLET_REQUEST, httpRequest);
msgContext.put(MessageContextJAXRPC.SERVLET_RESPONSE, httpResponse);
}
else
{
msgContext.put(MessageContextJAXWS.HTTP_REQUEST_HEADERS, headerSource.getHeaderMap());
msgContext.put(MessageContextJAXWS.HTTP_REQUEST_METHOD, httpRequest.getMethod());
msgContext.put(MessageContextJAXWS.QUERY_STRING, httpRequest.getQueryString());
msgContext.put(MessageContextJAXWS.PATH_INFO, httpRequest.getPathInfo());
msgContext.put(MessageContextJAXWS.SERVLET_CONTEXT, servletContext);
msgContext.put(MessageContextJAXWS.SERVLET_REQUEST, httpRequest);
msgContext.put(MessageContextJAXWS.SERVLET_RESPONSE, httpResponse);
}
}
// Associate a message context with the current thread
MessageContextAssociation.pushMessageContext(msgContext);
msgContext.setEndpointMetaData(sepMetaData);
try
{
MessageAbstraction resMessage = processRequest(endpoint, headerSource, invContext, inStream);
// Replace the message context with the response context
msgContext = MessageContextAssociation.peekMessageContext();
Map<String, List<String>> headers = (Map<String, List<String>>)msgContext.get(MessageContextJAXWS.HTTP_RESPONSE_HEADERS);
if (headerSource != null && headers != null)
headerSource.setHeaderMap(headers);
Integer code = (Integer)msgContext.get(MessageContextJAXWS.HTTP_RESPONSE_CODE);
if (httpResponse != null && code != null)
httpResponse.setStatus(code.intValue());
boolean isFault = false;
if (resMessage instanceof SOAPMessage)