log.info("initializing app context for spring-axis integration"); if (webAppCtx == null) { if (msgContext != null) { Object context = msgContext.getProperty(Constants.MC_SERVLET_ENDPOINT_CONTEXT); if (context instanceof ServletEndpointContext) { ServletEndpointContext servletEndpointContext = (ServletEndpointContext) context; ServletContext servletCtx = servletEndpointContext.getServletContext(); webAppCtx = WebApplicationContextUtils.getWebApplicationContext(servletCtx); if (webAppCtx == null) { log.info("failed to retrieve webapp context for spring-axis integration"); throw new ServiceException( "Cannot find WebApplicationContext from org.springframework.web.context.ContextLoaderListener"); } } else { log.info("failed to retrieve webapp context for spring-axis integration because this is an incorrect servlet context!"); throw new ServiceException("Invalid context - expected [" + ServletEndpointContext.class.getName() + "], actual [" + context + "]");
if (webAppCtx == null && msgContext != null) { Object context = msgContext.getProperty(Constants.MC_SERVLET_ENDPOINT_CONTEXT); if (context instanceof ServletEndpointContext) { ServletEndpointContext servletEndpointContext = (ServletEndpointContext) context; ServletContext servletCtx = servletEndpointContext.getServletContext(); webAppCtx = (WebApplicationContext) servletCtx .getAttribute(SpringAxisServlet.SERVLET_CONTEXT_ATTRIBUTE); if (webAppCtx == null) { throw new ServiceException( "Cannot find SpringAxisServlet's WebApplicationContext" + " as ServletContext attribute [" + SpringAxisServlet.SERVLET_CONTEXT_ATTRIBUTE + "]");
    private void initWebAppContext(MessageContext msgContext) throws ServiceException {        log.info("initializing app context for spring-axis integration");        if (webAppCtx == null) {            if (msgContext != null) {                Object context = msgContext.getProperty(Constants.MC_SERVLET_ENDPOINT_CONTEXT);                if (context instanceof ServletEndpointContext) {                    ServletEndpointContext servletEndpointContext = (ServletEndpointContext) context;                    ServletContext servletCtx = servletEndpointContext.getServletContext();                                    webAppCtx = WebApplicationContextUtils.getWebApplicationContext(servletCtx);                    if (webAppCtx == null) {                        log.info("failed to retrieve webapp context for spring-axis integration");                        throw new ServiceException(                            "Cannot find WebApplicationContext from org.springframework.web.context.ContextLoaderListener");                                                       }                } else {                    log.info("failed to retrieve webapp context for spring-axis integration because this is an incorrect servlet context!");                    throw new ServiceException("Invalid context - expected ["                            + ServletEndpointContext.class.getName()                            + "], actual ["                            + context                            + "]");                }            }            else {                log.info("null msg context!");            }        }    }