Package org.apache.axis

Examples of org.apache.axis.Handler


      MessageContext ctx = MessageContext.getCurrentContext();
      if (ctx == null) {
        throw new Exception("MessageContext = NULL");
      }

      Handler self = ctx.getService();
      if (self == null) {
        throw new Exception("Handler = NULL");
      }

      // Get service name
      String serviceName = self.getName();

      // see if we have a ResourceService_impl registered for that name
      ResourceService_impl serviceImpl = (ResourceService_impl) mResourceServiceImplMap
              .get(serviceName);
      if (serviceImpl != null) {
        return serviceImpl;
      }

      // No service impl registered for this service name, attempt to
      // create a new one

      // Get the Resource Specifier Path
      String resourceSpecifierPath = (String) self.getOption(PARAM_RESOURCE_SPECIFIER_PATH);
      if (resourceSpecifierPath == null || resourceSpecifierPath.trim().length() == 0) {
        throw new Exception("Invalid Configuration - " + PARAM_RESOURCE_SPECIFIER_PATH
                + " not Defined.  Check your deployment descriptor file (WSDD)");
      }
      // parse ResourceSpecifier
      ResourceSpecifier resourceSpecifier = UIMAFramework.getXMLParser().parseResourceSpecifier(
              new XMLInputSource(resourceSpecifierPath));

      // Get the number of instances to create
      String numInstancesStr = (String) self.getOption(PARAM_NUM_INSTANCES);
      int numInstances;
      try {
        numInstances = Integer.parseInt(numInstancesStr);
      } catch (NumberFormatException e) {
        throw new Exception("Invalid Configuration - " + PARAM_NUM_INSTANCES
                + " not valid.  Check your deployment descriptor file (WSDD)");
      }

      // Get whether to enable logging
      String enableLogStr = (String) self.getOption(PARAM_ENABLE_LOGGING);
      boolean enableLog = "true".equalsIgnoreCase(enableLogStr);

      // create and initialize the service implementation
      serviceImpl = (ResourceService_impl) aServiceImplClass.newInstance();
      HashMap initParams = new HashMap();
View Full Code Here


        if (log.isDebugEnabled()) {
            log.debug(JavaUtils.getMessage("enter00", "AxisClient::invoke"));
        }

        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 (log.isDebugEnabled()) {
                log.debug( "EngineHandler: " + hName );
            }

            if ( hName != null ) {
                h = getHandler( hName );
                if ( h != null )
                    h.invoke(msgContext);
                else
                    throw new AxisFault( "Client.error",
                                        JavaUtils.getMessage("noHandler00", hName),
                                        null, null );
            }
            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:         */
                /*                                                            */
                /*   Service Specific Request Chain                           */
                /*   Global Request Chain                                     */
                /*   Transport Request Chain - must have a send at the end    */
                /*   Transport Response Chain                                 */
                /*   Global Response Chain                                    */
                /*   Service Specific Response Chain                          */
                /*   Protocol Specific-Handler/Checker                        */
                /**************************************************************/

                // When do we call init/cleanup??

                SOAPService service = null ;
                msgContext.setPastPivot(false);

                /* Process the Service Specific Request Chain */
                /**********************************************/
                service = msgContext.getService();
                if ( service != null ) {
                    h = service.getRequestHandler();
                    if ( h != null )
                        h.invoke( msgContext );
                }

                /* Process the Global Request Chain */
                /**********************************/
                if ((h = getGlobalRequest()) != null )
                    h.invoke(msgContext);

                /** Process the Transport Specific stuff
                 *
                 * NOTE: Somewhere in here there is a handler which actually
                 * sends the message and receives a response.  Generally
                 * this is the pivot point in the Transport chain.
                 */
                hName = msgContext.getTransportName();
                if ( hName != null && (h = getTransport( hName )) != null )
                    h.invoke(msgContext);
                else
                    throw new AxisFault(JavaUtils.getMessage("noTransport00", hName));

                /* Process the Global Response Chain */
                /***********************************/
                if ((h = getGlobalResponse()) != null)
                    h.invoke(msgContext);

                if ( service != null ) {
                    h = service.getResponseHandler();
                    if ( h != null )
                        h.invoke(msgContext);
                }

                // Do SOAP Semantics checks here - this needs to be a call to
                // a pluggable object/handler/something
            }
View Full Code Here

            log.debug( JavaUtils.getMessage("enter00", "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);
        String  allowedMethods = getAllowedMethods(service);
View Full Code Here

   
    /**
     * Returns the Class info about the service class.
     */
    protected Class getServiceClass(MessageContext msgContext, String clsName) throws Exception {
        Handler service = msgContext.getService();
        Object obj = getServiceObject(msgContext,
                                   service,
                                   clsName);
       
        return obj.getClass();
View Full Code Here

                    JavaUtils.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( JavaUtils.getMessage("tryingLoad00", hName) );
                        Class cls = cl.loadClass( hName );
                        h = (Handler) cls.newInstance();
                    }
                    catch( Exception e ) {
                        h = null ;
                    }
                }
                if ( h != null )
                    h.invoke(msgContext);
                else
                    throw new AxisFault( "Server.error",
                        JavaUtils.getMessage("noHandler00", hName),
                        null, null );
            }
            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??
                if (log.isDebugEnabled()) {
                    log.debug(JavaUtils.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.invoke(msgContext);
                } else {
                log.error(JavaUtils.getMessage("noTransport02", hName));
                }
                } else {
                // No transport set, so use the default (probably just
                // calls the global->service handlers)
                defaultTransport.invoke(msgContext);
                }

                */

                /* Process the Transport Specific Request Chain */
                /**********************************************/
                hName = msgContext.getTransportName();
                SimpleTargetedChain transportChain = null;

                if (log.isDebugEnabled())
                    log.debug(JavaUtils.getMessage("transport01", "AxisServer.invoke", hName));

                if ( hName != null && (h = getTransport( hName )) != null ) {
                    if (h instanceof SimpleTargetedChain) {
                        transportChain = (SimpleTargetedChain)h;
                        h = transportChain.getRequestHandler();
                        if (h != null)
                            h.invoke(msgContext);
                    }
                }

                /* Process the Global Request Chain */
                /**********************************/
                if ((h = getGlobalRequest()) != null )
                    h.invoke(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();
                    rm.getSOAPEnvelope().getFirstBody();
                    h = msgContext.getService();
                    if (h == null)
                        throw new AxisFault("Server.NoService",
                            JavaUtils.getMessage("noService05",
                                    "" + msgContext.getTargetService()),
                            null, null );
                }

                h.invoke(msgContext);

                /* 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);
                }
            }
        } catch (AxisFault e) {
            throw e;
        } catch (Exception 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

                    JavaUtils.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( JavaUtils.getMessage("tryingLoad00", hName) );
                        Class cls = cl.loadClass( hName );
                        h = (Handler) cls.newInstance();
                    }
                    catch( Exception e ) {
                        throw new AxisFault(
                                "Server.error",
                                JavaUtils.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( JavaUtils.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(JavaUtils.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(JavaUtils.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("Server.NoService",
                                JavaUtils.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) {
View Full Code Here

public class BasicServerConfig extends SimpleProvider {
    /**
     * Constructor - deploy a hardcoded basic server-side configuration.
     */
    public BasicServerConfig() {
        Handler h = new LocalResponder();
        SimpleTargetedChain transport = new SimpleTargetedChain(null, null, h);
        deployTransport("local", transport);
    }
View Full Code Here

                                SOAPEnvelope resEnv,
                                JavaClass jc,
                                Object obj)
        throws Exception
    {
        Handler targetService = msgContext.getService();
       
        // is this service a body-only service?
        // if true (the default), the servic3e expects two args,
        // a MessageContext and a Document which is the contents of the first body element.
        // if false, the service expects just one MessageContext argument,
        // and looks at the entire request envelope in the MessageContext
        // (hence it's a "FullMessageService").
        boolean bodyOnlyService = true;
        if (targetService.getOption("FullMessageService") != null) {
            bodyOnlyService = false;
        }
       
        Class[]         argClasses;
        Object[]        argObjects;
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.