Package org.apache.axis

Examples of org.apache.axis.Handler


                                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;
View Full Code Here


     */
    protected Handler makeNewInstance(EngineConfiguration registry)
        throws ConfigurationException
    {
        Class   c = null;
        Handler h = null;

        try {
            c = getJavaClass();
        } catch (ClassNotFoundException e) {
            throw new ConfigurationException(e);
        }

        if (c != null) {
            try {
                h = (Handler)createInstance(c);
            } catch (Exception e) {
                throw new ConfigurationException(e);
            }

            if (h != null) {
                if ( qname != null )
                  h.setName(qname.getLocalPart());
                h.setOptions(getParametersTable());
                try{
                  h.init();
                }catch(Exception e){
                    String msg=e + JavaUtils.LS + JavaUtils.stackToString(e);
                    log.debug(msg);
                    throw new ConfigurationException(e);
                }catch(Error e){
View Full Code Here

    public TypeMapping getTypeMapping(String encodingStyle) throws ConfigurationException {
        return (TypeMapping)getTypeMappingRegistry().getTypeMapping(encodingStyle);
    }

    public Handler getTransport(QName qname) throws ConfigurationException {
        Handler transport = (Handler)transports.get(qname);
        if ((defaultConfiguration != null) && (transport == null))
            transport = defaultConfiguration.getTransport(qname);
        return transport;
    }
View Full Code Here

            service = defaultConfiguration.getServiceByNamespaceURI(namespace);
        return service;
    }

    public Handler getHandler(QName qname) throws ConfigurationException {
        Handler handler = (Handler)handlers.get(qname);
        if ((defaultConfiguration != null) && (handler == null))
            handler = defaultConfiguration.getHandler(qname);
        return handler;
    }
View Full Code Here

         */

        /** For now, though - make sure we can only admin from our own
         * IP, unless the remoteAdmin option is set.
         */
        Handler serviceHandler = msgContext.getService();
        if (serviceHandler != null  &&
            !JavaUtils.isTrueExplicitly(serviceHandler.getOption("enableRemoteAdmin"))) {

            String remoteIP = msgContext.getStrProp(Constants.MC_REMOTE_ADDR);
            if (remoteIP != null  &&
                !remoteIP.equals("127.0.0.1")) {

View Full Code Here

    public void testOptions() throws Exception
    {
        XMLStringProvider provider = new XMLStringProvider(goodWSDD);
        AxisServer server = new AxisServer(provider);
       
        Handler h1 = server.getHandler(HANDLER_NAME);
        assertNotNull("Couldn't get logger handler from engine!", h1);

        AdminClient client = new AdminClient();
        String doc = header + badHandler + footer;
        ByteArrayInputStream stream = new ByteArrayInputStream(doc.getBytes());
View Full Code Here

            log.debug("Enter: JavaProvider::invoke (" + this + ")");

        /* Find the service we're invoking so we can grab it's options */
        /***************************************************************/
        String serviceName = msgContext.getTargetService();
        Handler service = msgContext.getService();

        /* Now get the service (RPC) specific info  */
        /********************************************/
        String  clsName    = getServiceClassName(service);

View Full Code Here

    public void testUndeployHandlerViaAdmin() throws Exception
    {
        XMLStringProvider provider = new XMLStringProvider(deployDoc);
        AxisServer server = new AxisServer(provider);
       
        Handler handler = server.getHandler("other");
        assertNotNull("Couldn't get handler", handler);

        AdminClient client = new AdminClient();
        Call call = client.getCall();
        LocalTransport transport = new LocalTransport(server);
View Full Code Here

     * @throws ConfigurationException XXX
     */
    public Handler makeNewInstance(EngineConfiguration registry)
        throws ConfigurationException
    {
        Handler reqHandler = null;

        WSDDChain req = getRequestFlow();
        if (req != null)
            reqHandler = req.getInstance(registry);
       
        Handler pivot = null;
        if (pivotQName != null) {
            if (URI_WSDD_JAVA.equals(pivotQName.getNamespaceURI())) {
                try {
                    pivot = (Handler)ClassUtils.forName(pivotQName.getLocalPart()).newInstance();
                } catch (InstantiationException e) {
                    throw new ConfigurationException(e);
                } catch (IllegalAccessException e) {
                    throw new ConfigurationException(e);
                } catch (ClassNotFoundException e) {
                    throw new ConfigurationException(e);
                }
            } else {
                pivot = registry.getHandler(pivotQName);
            }
        }
       
        Handler respHandler = null;
        WSDDChain resp = getResponseFlow();
        if (resp != null)
            respHandler = resp.getInstance(registry);

        return new org.apache.axis.SimpleTargetedChain(reqHandler, pivot,
View Full Code Here

        }

        // Make sure tmr is initialized.
        initTMR();

        Handler reqHandler = null;
        WSDDChain request = getRequestFlow();

        if (request != null) {
            reqHandler = request.getInstance(registry);
        }

        Handler providerHandler = null;

        if (providerQName != null) {
            try {
                providerHandler = WSDDProvider.getInstance(providerQName,
                                                           this,
                                                           registry);
            } catch (Exception e) {
                throw new ConfigurationException(e);
            }
            if (providerHandler == null)
                throw new WSDDException(
                          Messages.getMessage("couldntConstructProvider00"));
        }

        Handler respHandler = null;
        WSDDChain response = getResponseFlow();

        if (response != null) {
            respHandler = response.getInstance(registry);
        }

        SOAPService service = new SOAPService(reqHandler, providerHandler,
                                              respHandler);
        service.setStyle(style);
        service.setUse(use);
        service.setHighFidelityRecording(!streaming);
        service.setSendType(sendType);

        if ( getQName() != null )
            service.setName(getQName().getLocalPart());
        service.setOptions(getParametersTable());

        service.setEngine(((WSDDDeployment)registry).getEngine());

        if (use != Use.ENCODED) {
            // If not encoded, turn off multi-refs and prefer
            // not to sent xsi:type and xsi:nil
            service.setOption(AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
            service.setOption(AxisEngine.PROP_SEND_XSI, Boolean.FALSE);
        }

  // Set handlerInfoChain
  if (_wsddHIchain != null) {
            HandlerInfoChainFactory hiChainFactory = _wsddHIchain.getHandlerChainFactory();

      service.setOption(Constants.ATTR_HANDLERINFOCHAIN, hiChainFactory);
  }

        AxisEngine.normaliseOptions(service);
        tmr.delegate(registry.getTypeMappingRegistry());

        WSDDFaultFlow [] faultFlows = getFaultFlows();
        if (faultFlows != null && faultFlows.length > 0) {
            FaultableHandler wrapper = new FaultableHandler(service);
            for (int i = 0; i < faultFlows.length; i++) {
                WSDDFaultFlow flow = faultFlows[i];
                Handler faultHandler = flow.getInstance(registry);
                wrapper.setOption("fault-" + flow.getQName().getLocalPart(),
                                  faultHandler);
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.axis.Handler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.