📄 axisserver.java
字号:
h = msgContext.getService(); if (h == null) { // It's possible that we haven't yet parsed the // message at this point. This is a kludge to // make sure we have. There probably wants to be // some kind of declarative "parse point" on the handler // chain instead.... Message rm = msgContext.getRequestMessage(); rm.getSOAPEnvelope().getFirstBody(); h = msgContext.getService(); if (h == null) throw new AxisFault("Server.NoService", Messages.getMessage("noService05", "" + msgContext.getTargetService()), null, null ); } if( tlog.isDebugEnabled() ) { t3=System.currentTimeMillis(); } initSOAPConstants(msgContext); try { h.invoke(msgContext); } catch (AxisFault ae) { if ((h = getGlobalRequest()) != null ) { h.onFault(msgContext); } throw ae; } if( tlog.isDebugEnabled() ) { t4=System.currentTimeMillis(); } /* Process the Global Response Chain */ /***********************************/ if ((h = getGlobalResponse()) != null) h.invoke(msgContext); /* Process the Transport Specific Response Chain */ /***********************************************/ if (transportChain != null) { h = transportChain.getResponseHandler(); if (h != null) h.invoke(msgContext); } if( tlog.isDebugEnabled() ) { t5=System.currentTimeMillis(); tlog.debug( "AxisServer.invoke2 " + " preTr=" + ( t1-t0 ) + " tr=" + (t2-t1 ) + " preInvoke=" + ( t3-t2 ) + " invoke=" + ( t4-t3 ) + " postInvoke=" + ( t5-t4 ) + " " + msgContext.getTargetService() + "." + ((msgContext.getOperation( ) == null) ? "" : msgContext.getOperation().getName()) ); } } } catch (AxisFault e) { throw e; } catch (Exception e) { // Should we even bother catching it ? throw AxisFault.makeFault(e); } finally { // restore previous state setCurrentMessageContext(previousContext); } if (log.isDebugEnabled()) { log.debug("Exit: AxisServer::invoke"); } } /** * Extract ans store soap constants info from the envelope * @param msgContext * @throws AxisFault */ private void initSOAPConstants(MessageContext msgContext) throws AxisFault { Message msg = msgContext.getRequestMessage(); if (msg == null) return; SOAPEnvelope env = msg.getSOAPEnvelope(); if (env == null) return; SOAPConstants constants = env.getSOAPConstants(); if (constants == null) return; // Ensure that if we get SOAP1.2, then reply using SOAP1.2 msgContext.setSOAPConstants(constants); } /** * */ public void generateWSDL(MessageContext msgContext) throws AxisFault { if (log.isDebugEnabled()) { log.debug("Enter: AxisServer::generateWSDL"); } if (!isRunning()) { throw new AxisFault("Server.disabled", Messages.getMessage("serverDisabled00"), null, null); } String hName = null ; Handler h = null ; // save previous context MessageContext previousContext = getCurrentMessageContext(); try { // set active context setCurrentMessageContext(msgContext); hName = msgContext.getStrProp( MessageContext.ENGINE_HANDLER ); if ( hName != null ) { if ( (h = getHandler(hName)) == null ) { ClassLoader cl = msgContext.getClassLoader(); try { log.debug( Messages.getMessage("tryingLoad00", hName) ); Class cls = ClassUtils.forName(hName, true, cl); h = (Handler) cls.newInstance(); } catch( Exception e ) { throw new AxisFault( "Server.error", Messages.getMessage("noHandler00", hName), null, null ); } } h.generateWSDL(msgContext); } else { // This really should be in a handler - but we need to discuss it // first - to make sure that's what we want. /* Now we do the 'real' work. The flow is basically: */ /* Transport Specific Request Handler/Chain */ /* Global Request Handler/Chain */ /* Protocol Specific-Handler(ie. SOAP, XP) */ /* ie. For SOAP Handler: */ /* - Service Specific Request Handler/Chain */ /* - SOAP Semantic Checks */ /* - Service Specific Response Handler/Chain */ /* Global Response Handler/Chain */ /* Transport Specific Response Handler/Chain */ /**************************************************************/ // When do we call init/cleanup?? log.debug( Messages.getMessage("defaultLogic00") ); /* This is what the entirety of this logic might evolve to: hName = msgContext.getStrProp(MessageContext.TRANSPORT); if ( hName != null ) { if ((h = hr.find( hName )) != null ) { h.generateWSDL(msgContext); } else { log.error(Messages.getMessage("noTransport02", hName)); } } else { // No transport set, so use the default (probably just // calls the global->service handlers) defaultTransport.generateWSDL(msgContext); } */ /* Process the Transport Specific Request Chain */ /**********************************************/ hName = msgContext.getTransportName(); SimpleTargetedChain transportChain = null; if (log.isDebugEnabled()) log.debug(Messages.getMessage("transport01", "AxisServer.generateWSDL", hName)); if ( hName != null && (h = getTransport( hName )) != null ) { if (h instanceof SimpleTargetedChain) { transportChain = (SimpleTargetedChain)h; h = transportChain.getRequestHandler(); if (h != null) { h.generateWSDL(msgContext); } } } /* Process the Global Request Chain */ /**********************************/ if ((h = getGlobalRequest()) != null ) h.generateWSDL(msgContext); /** * At this point, the service should have been set by someone * (either the originator of the MessageContext, or one of the * transport or global Handlers). If it hasn't been set, we * fault. */ h = msgContext.getService(); if (h == null) { // It's possible that we haven't yet parsed the // message at this point. This is a kludge to // make sure we have. There probably wants to be // some kind of declarative "parse point" on the handler // chain instead.... Message rm = msgContext.getRequestMessage(); if (rm != null) { rm.getSOAPEnvelope().getFirstBody(); h = msgContext.getService(); } if (h == null) { throw new AxisFault(Constants.QNAME_NO_SERVICE_FAULT_CODE, Messages.getMessage("noService05", "" + msgContext.getTargetService()), null, null ); } } h.generateWSDL(msgContext); /* Process the Global Response Chain */ /***********************************/ if ((h = getGlobalResponse()) != null ) h.generateWSDL(msgContext); /* Process the Transport Specific Response Chain */ /***********************************************/ if (transportChain != null) { h = transportChain.getResponseHandler(); if (h != null) { h.generateWSDL(msgContext); } } } } catch (AxisFault e) { throw e; } catch(Exception e) { // Should we even bother catching it ? throw AxisFault.makeFault(e); } finally { // restore previous state setCurrentMessageContext(previousContext); } if (log.isDebugEnabled()) { log.debug("Exit: AxisServer::generateWSDL"); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -