axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject cvs commit: xml-axis/java/test/RPCDispatch TestRPC.java
Date Sun, 10 Jun 2001 19:57:24 GMT
gdaniels    01/06/10 12:57:24

  Modified:    java/src/org/apache/axis Constants.java MessageContext.java
               java/src/org/apache/axis/client AxisClient.java
               java/src/org/apache/axis/encoding
                        SOAPTypeMappingRegistry.java
                        TypeMappingRegistry.java
               java/src/org/apache/axis/handlers/tcp TCPActionHandler.java
               java/src/org/apache/axis/server AxisServer.java
               java/src/org/apache/axis/transport/http AxisServlet.java
                        SimpleAxisServer.java
               java/test/RPCDispatch TestRPC.java
  Added:       java/src/org/apache/axis AxisEngine.java
  Log:
  * First cut at the AxisEngine hierarchy
  
  Introduce an abstract AxisEngine base class, from which both AxisClient
  and AxisServer inherit.  The AxisEngine handles the registries and loading
  engine-wide properties from a properties file (this should migrate to
  XML at some point).  init() has been factored out of both AxisClient and
  AxisServer.
  
  Enable setting default debug level via the properties file.
  
  The AxisEngine class also has the handler and service registries as first-
  class member vars, with getters and setters, rather than using the
  option bag for this.  This required various tweaks to classes that wanted
  to use the option bag.
  
  * Add a test to TestRPC to verify that dispatching off the RPC body
    element QName works
  
  * Fix a potential NPE bug in AxisServlet
  
  * Pull AxisEngine out into a member variable in MessageContext
  
  * Remove the static SOAPTypeMappingRegistry from MessageContext, replace
    with SOAPTypeMappingRegistry.getSingleton()
  
  Revision  Changes    Path
  1.17      +0 -1      xml-axis/java/src/org/apache/axis/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/Constants.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Constants.java	2001/06/08 00:12:00	1.16
  +++ Constants.java	2001/06/10 19:57:22	1.17
  @@ -61,7 +61,6 @@
     //  not all Engines will have notion of registries but defining these
     //  here should allow people to ask if they exist)
     //////////////////////////////////////////////////////////////////////////
  -  public static String AXIS_ENGINE      = "AxisEngine" ;
     public static String HANDLER_REGISTRY = "HandlerRegistry" ;
     public static String SERVICE_REGISTRY = "ServiceRegistry" ;
     public static String TYPEMAP_REGISTRY = "TypeMapRegistry" ;
  
  
  
  1.30      +22 -7     xml-axis/java/src/org/apache/axis/MessageContext.java
  
  Index: MessageContext.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/MessageContext.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- MessageContext.java	2001/06/07 14:50:47	1.29
  +++ MessageContext.java	2001/06/10 19:57:23	1.30
  @@ -58,6 +58,7 @@
   import java.util.* ;
   import org.apache.axis.* ;
   import org.apache.axis.utils.AxisClassLoader ;
  +import org.apache.axis.utils.Debug ;
   import org.apache.axis.encoding.TypeMappingRegistry;
   import org.apache.axis.encoding.SOAPTypeMappingRegistry;
   import org.apache.axis.encoding.ServiceDescription;
  @@ -111,6 +112,11 @@
        * The default classloader that this service should use
        */
       private AxisClassLoader  classLoader ;
  +    
  +    /**
  +     * The AxisEngine which this context is involved with
  +     */
  +    private AxisEngine       axisEngine;
   
       /**
        *
  @@ -126,9 +132,6 @@
        */
       private TypeMappingRegistry mappingRegistry = null;
   
  -    private static final SOAPTypeMappingRegistry soapTMR =
  -        new SOAPTypeMappingRegistry();
  -
       public void setTypeMappingRegistry(TypeMappingRegistry reg) {
           mappingRegistry = reg;
       }
  @@ -136,7 +139,7 @@
       public TypeMappingRegistry getTypeMappingRegistry() {
           if (mappingRegistry == null) {
               mappingRegistry = new TypeMappingRegistry();
  -            mappingRegistry.setParent(soapTMR);
  +            mappingRegistry.setParent(SOAPTypeMappingRegistry.getSingleton());
           }
           return mappingRegistry;
       }
  @@ -200,6 +203,16 @@
       public String getTargetService() {
         return( targetService );
       }
  +    
  +    public void setAxisEngine(AxisEngine engine)
  +    {
  +      this.axisEngine = engine;
  +    }
  +    
  +    public AxisEngine getAxisEngine()
  +    {
  +      return axisEngine;
  +    }
   
       /**
        * Set the target service for this message.
  @@ -211,6 +224,7 @@
        * @param tServ the name of the target service.
        */
       public void setTargetService(String tServ) {
  +        Debug.Print(2, "MessageContext: setTargetService(" + tServ+")");
           targetService = tServ ;
   
           HandlerRegistry sr = (HandlerRegistry)
  @@ -236,6 +250,7 @@
       }
   
       public Handler getServiceHandler() {
  +        Debug.Print(2, "MessageContext:getServiceHandler()");
           if (serviceHandler == null) {
               if (targetService != null) {
                   /** This is a bit kludgey for now - what might have
  @@ -271,17 +286,17 @@
                   }
               }
         }
  +      Debug.Print(2, "MessageContext:getServiceHandler() returns " + serviceHandler);
         return( serviceHandler );
       }
       
       public void setServiceHandler(Handler sh)
       {
  +      Debug.Print(2,"MessageContext: setServiceHandler("+sh+")");
         serviceHandler = sh;
         if (sh != null && sh instanceof SOAPService) {
           TypeMappingRegistry tmr = ((SOAPService)sh).getTypeMappingRegistry();
  -        getTypeMappingRegistry().setParent(tmr);
  -      } else {
  -        getTypeMappingRegistry().setParent(soapTMR);
  +        setTypeMappingRegistry(tmr);
         }
       }
   
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/AxisEngine.java
  
  Index: AxisEngine.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.axis;
  
  import java.io.*;
  import java.util.* ;
  import org.apache.axis.* ;
  import org.apache.axis.utils.* ;
  import org.apache.axis.handlers.* ;
  import org.apache.axis.handlers.soap.* ;
  import org.apache.axis.registries.* ;
  import org.apache.axis.encoding.SOAPTypeMappingRegistry;
  import org.apache.axis.encoding.TypeMappingRegistry;
  
  /**
   * An <code>AxisEngine</code> is the base class for AxisClient and
   * AxisServer.  Handles common functionality like dealing with the
   * handler/service registries and loading properties.
   *
   * @author Glen Daniels (gdaniels@allaire.com)
   */
  public abstract class AxisEngine extends BasicHandler
  {
      /** The handler registry this Engine uses. */
      protected HandlerRegistry _handlerRegistry;
      protected String handlerRegFilename;
      
      /** The service registry this Engine uses. */
      protected HandlerRegistry _serviceRegistry;
      protected String serviceRegFilename;
      
      protected Properties props = new Properties();
      
      /**
       * No-arg constructor.  Loads properties from the "axis.properties"
       * file if it exists.
       * 
       */
      public AxisEngine()
      {
          Debug.Print( 1, "Enter: AxisEngine no-arg constructor");
          try {
              File propFile = new File("axis.properties");
              if (propFile.exists()) {
                  FileInputStream propFileInputStream =
                           new FileInputStream(propFile);
                  props.load(propFileInputStream);
              }
          } catch (Exception e) {
              e.printStackTrace();
          }
          Debug.Print( 1, "Exit: AxisEngine no-arg constructor");
      }
      
      /**
       * Allows the Listener to specify which handler/service registry
       * implementation they want to use.
       * 
       * @param handlers the Handler registry.
       * @param services the Service registry.
       */
      public AxisEngine(HandlerRegistry handlers, HandlerRegistry services)
      {
          this();
          handlers.init();
          services.init();
          setHandlerRegistry(handlers);
          setServiceRegistry(services);
      }
  
      /**
       * Constructor specifying registry filenames.
       * 
       * @param handlerRegFilename the name of the Handler registry file.
       * @param serviceRegFilename the name of the Service registry file.
       */
      public AxisEngine(String handlerRegFilename, String serviceRegFilename)
      {
          this();
          this.handlerRegFilename = handlerRegFilename;
          this.serviceRegFilename = serviceRegFilename;
      }
  
      /**
       * Find/load the registries and save them so we don't need to do this
       * each time we're called.
       */
      public void init() {
          // Load the simple handler registry and init it
          Debug.Print( 1, "Enter: AxisEngine::init" );
          
          String propVal = props.getProperty("debugLevel", "0");
          Debug.setDebugLevel(Integer.parseInt(propVal));
          System.out.println("Debug level is " + Debug.getDebugLevel());
          
          if (getHandlerRegistry() == null) {
              System.out.println("Using " + handlerRegFilename);
              DefaultHandlerRegistry  hr =
                           new DefaultHandlerRegistry(handlerRegFilename);
              hr.setOnServer( true );
              hr.init();
              setHandlerRegistry( hr );
          }
          
          if (getServiceRegistry() == null) {
              System.out.println("Using " + serviceRegFilename);
              // Load the simple deployed services registry and init it
              DefaultServiceRegistry  sr =
                           new DefaultServiceRegistry(serviceRegFilename);
              sr.setHandlerRegistry( getHandlerRegistry() ); // needs to know about 'hr'
              sr.setOnServer( true );
              sr.init();
              setServiceRegistry( sr );
          }
  
          // Load the registry of deployed types
          TypeMappingRegistry tmr = new TypeMappingRegistry("typemap-supp.reg");
          tmr.setParent(new SOAPTypeMappingRegistry());
          addOption( Constants.TYPEMAP_REGISTRY, tmr );
          
          /** ??? Why are we doing this??
           */
          Handler admin = getServiceRegistry().find("AdminService");
          if (admin != null && admin instanceof SOAPService)
            ((SOAPService)admin).setTypeMappingRegistry(tmr);
  
          Debug.Print( 1, "Exit: AxisEngine::init" );
      }
  
      public HandlerRegistry getHandlerRegistry()
      {
          return _handlerRegistry;
      }
      
      public void setHandlerRegistry(HandlerRegistry registry)
      {
          _handlerRegistry = registry;
      }
      
      public HandlerRegistry getServiceRegistry()
      {
          return _serviceRegistry;
      }
      
      public void setServiceRegistry(HandlerRegistry registry)
      {
          _serviceRegistry = registry;
      }    
  };
  
  
  
  1.10      +8 -45     xml-axis/java/src/org/apache/axis/client/AxisClient.java
  
  Index: AxisClient.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/AxisClient.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- AxisClient.java	2001/06/02 04:01:17	1.9
  +++ AxisClient.java	2001/06/10 19:57:23	1.10
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -70,51 +70,16 @@
    * @author Doug Davis (dug@us.ibm.com)
    * @author Glen Daniels (gdaniels@allaire.com)
    */
  -public class AxisClient extends BasicHandler
  +public class AxisClient extends AxisEngine
   {
  -    public AxisClient() {}
  -    
  -    /**
  -     * Allows the Listener to specify which handler/service registry
  -     * implementation they want to use.
  -     */
  -    /*
  -    public AxisClient(HandlerRegistry handlers, HandlerRegistry services)
  +    public AxisClient()
       {
  -        Debug.Print( 1, "Enter: AxisClient::Constructor");
  -        handlers.init();
  -        services.init();
  -        addOption(Constants.HANDLER_REGISTRY, handlers);
  -        addOption(Constants.SERVICE_REGISTRY, services);
  -        Debug.Print( 1, "Exit: AxisClient::Constructor");
  -     }*/
  -    
  -    /**
  -     * Find/load the registries and save them so we don't need to do this
  -     * each time we're called.
  -     * Package access since this should be wrapped by ServiceClient...??? -- RobJ
  -     */
  -    public void init() {
  -        // Load the simple handler registry and init it
  -        Debug.Print( 1, "Enter: AxisClient::init" );
  -        DefaultHandlerRegistry  hr =
  -            new DefaultHandlerRegistry(Constants.CLIENT_HANDLER_REGISTRY);
  -        hr.setOnServer( false );
  -        hr.init();
  -        addOption( Constants.HANDLER_REGISTRY, hr );
  -        
  -        // Load the simple deployed services registry and init it
  -        DefaultServiceRegistry  sr =
  -            new DefaultServiceRegistry(Constants.CLIENT_SERVICE_REGISTRY);
  -        sr.setHandlerRegistry( hr ); // Needs to know about 'hr'
  -        sr.setOnServer( false );
  -        sr.init();
  -        addOption( Constants.SERVICE_REGISTRY, sr );
  -        Debug.Print( 1, "Exit: AxisClient::init" );
  +        super(Constants.CLIENT_HANDLER_REGISTRY,
  +              Constants.CLIENT_SERVICE_REGISTRY);
       }
       
       /**
  -     * Main routine of the AXIS server.  In short we locate the appropriate
  +     * Main routine of the AXIS engine.  In short we locate the appropriate
        * handler for the desired service and invoke() it.
        */
       public void invoke(MessageContext msgContext) throws AxisFault {
  @@ -123,10 +88,8 @@
           String  hName = null ;
           Handler h     = null ;
           
  -        HandlerRegistry hr =
  -            (HandlerRegistry) getOption(Constants.HANDLER_REGISTRY);
  -        HandlerRegistry sr =
  -            (HandlerRegistry) getOption(Constants.SERVICE_REGISTRY);
  +        HandlerRegistry hr = getHandlerRegistry();
  +        HandlerRegistry sr = getServiceRegistry();
           
           try {
               hName = msgContext.getStrProp( MessageContext.ENGINE_HANDLER );
  
  
  
  1.15      +8 -9      xml-axis/java/src/org/apache/axis/encoding/SOAPTypeMappingRegistry.java
  
  Index: SOAPTypeMappingRegistry.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/SOAPTypeMappingRegistry.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- SOAPTypeMappingRegistry.java	2001/05/10 01:02:41	1.14
  +++ SOAPTypeMappingRegistry.java	2001/06/10 19:57:23	1.15
  @@ -186,15 +186,14 @@
   
           // !!! Seems a little weird to pass a null class here...?
           addDeserializerFactory(SOAP_ARRAY, null, ArraySerializer.factory);
  -        /*
  -        addDeserializerFactory(SOAP_STRING, se);
  -        addDeserializerFactory(SOAP_BOOLEAN, se);
  -        addDeserializerFactory(SOAP_DOUBLE, se);
  -        addDeserializerFactory(SOAP_FLOAT, se);
  -        addDeserializerFactory(SOAP_INT, se);
  -        addDeserializerFactory(SOAP_LONG, se);
  -        addDeserializerFactory(SOAP_SHORT, se);
  -        */
  +    }
  +    
  +    private static SOAPTypeMappingRegistry singleton = null;
  +    public synchronized static SOAPTypeMappingRegistry getSingleton()
  +    {
  +        if (singleton == null)
  +            singleton = new SOAPTypeMappingRegistry();
  +        return singleton;
       }
       
   }
  
  
  
  1.13      +1 -0      xml-axis/java/src/org/apache/axis/encoding/TypeMappingRegistry.java
  
  Index: TypeMappingRegistry.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/TypeMappingRegistry.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- TypeMappingRegistry.java	2001/06/07 14:01:56	1.12
  +++ TypeMappingRegistry.java	2001/06/10 19:57:23	1.13
  @@ -56,6 +56,7 @@
   package org.apache.axis.encoding;
   
   import java.util.Hashtable;
  +import java.util.Enumeration;
   import org.apache.axis.Constants;
   import org.apache.axis.utils.*;
   import org.apache.axis.utils.events.*;
  
  
  
  1.2       +2 -2      xml-axis/java/src/org/apache/axis/handlers/tcp/TCPActionHandler.java
  
  Index: TCPActionHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/tcp/TCPActionHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TCPActionHandler.java	2001/05/31 09:24:30	1.1
  +++ TCPActionHandler.java	2001/06/10 19:57:23	1.2
  @@ -128,8 +128,8 @@
             // and possibly wrong.
             // ROBJ 911 What *is* the right way to get to the HandlerRegistry from here?!
             // Is it in the MessageContext?  ... let's look ...
  -          Handler engine = (Handler)msgContext.getProperty(Constants.AXIS_ENGINE);
  -          HandlerRegistry hr = (HandlerRegistry)engine.getOption(Constants.HANDLER_REGISTRY);
  +          AxisEngine engine = (AxisEngine)msgContext.getAxisEngine();
  +          HandlerRegistry hr = engine.getHandlerRegistry();
             String[] list = hr.list();
             Handler handler = null;
             for (int i = 0; i < list.length; i++) {
  
  
  
  1.15      +9 -47     xml-axis/java/src/org/apache/axis/server/AxisServer.java
  
  Index: AxisServer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/server/AxisServer.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- AxisServer.java	2001/06/07 14:02:11	1.14
  +++ AxisServer.java	2001/06/10 19:57:24	1.15
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -69,10 +69,11 @@
    * @author Doug Davis (dug@us.ibm.com)
    * @author Glen Daniels (gdaniels@allaire.com)
    */
  -public class AxisServer extends BasicHandler
  +public class AxisServer extends AxisEngine
   {
       public AxisServer() {
  -      // Debug.setDebugLevel(3);
  +      super(Constants.SERVER_HANDLER_REGISTRY,
  +            Constants.SERVER_SERVICE_REGISTRY);
       }
   
       /**
  @@ -81,47 +82,10 @@
        */
       public AxisServer(HandlerRegistry handlers, HandlerRegistry services)
       {
  -        Debug.Print( 1, "Enter: AxisServer::Constructor");
  -        handlers.init();
  -        services.init();
  -        addOption(Constants.HANDLER_REGISTRY, handlers);
  -        addOption(Constants.SERVICE_REGISTRY, services);
  -        Debug.Print( 1, "Exit: AxisServer::Constructor");
  +        super(handlers, services);
       }
   
       /**
  -     * Find/load the registries and save them so we don't need to do this
  -     * each time we're called.
  -     */
  -    public void init() {
  -        // Load the simple handler registry and init it
  -        Debug.Print( 1, "Enter: AxisServer::init" );
  -        DefaultHandlerRegistry  hr =
  -          new DefaultHandlerRegistry(Constants.SERVER_HANDLER_REGISTRY);
  -        hr.setOnServer( true );
  -        hr.init();
  -        addOption( Constants.HANDLER_REGISTRY, hr );
  -
  -        // Load the simple deployed services registry and init it
  -        DefaultServiceRegistry  sr =
  -          new DefaultServiceRegistry(Constants.SERVER_SERVICE_REGISTRY);
  -        sr.setHandlerRegistry( hr ); // needs to know about 'hr'
  -        sr.setOnServer( true );
  -        sr.init();
  -        addOption( Constants.SERVICE_REGISTRY, sr );
  -
  -        // Load the registry of deployed types
  -        TypeMappingRegistry tmr = new TypeMappingRegistry("typemap-supp.reg");
  -        tmr.setParent(new SOAPTypeMappingRegistry());
  -        addOption( Constants.TYPEMAP_REGISTRY, tmr );
  -        Handler admin = sr.find("AdminService");
  -        if (admin != null && admin instanceof SOAPService)
  -          ((SOAPService)admin).setTypeMappingRegistry(tmr);
  -
  -        Debug.Print( 1, "Exit: AxisServer::init" );
  -    }
  -
  -    /**
        * Main routine of the AXIS server.  In short we locate the appropriate
        * handler for the desired service and invoke() it.
        */
  @@ -134,18 +98,16 @@
           /* Do some prep-work.  Get the registries and put them in the */
           /* msgContext so they can be used by later handlers.          */
           /**************************************************************/
  -        HandlerRegistry hr =
  -            (HandlerRegistry) getOption(Constants.HANDLER_REGISTRY);
  -        HandlerRegistry sr =
  -            (HandlerRegistry) getOption(Constants.SERVICE_REGISTRY);
  +        HandlerRegistry hr = getHandlerRegistry();
  +        HandlerRegistry sr = getServiceRegistry();
           TypeMappingRegistry tmr =
               (TypeMappingRegistry) getOption(Constants.TYPEMAP_REGISTRY);
   
  -        msgContext.setProperty(Constants.AXIS_ENGINE, this );
  +        msgContext.setAxisEngine( this );
           msgContext.setProperty(Constants.HANDLER_REGISTRY, hr);
           msgContext.setProperty(Constants.SERVICE_REGISTRY, sr);
   
  -        msgContext.getTypeMappingRegistry().setParent(tmr);
  +        msgContext.setTypeMappingRegistry(tmr);
   
           try {
             hName = msgContext.getStrProp( MessageContext.ENGINE_HANDLER );
  
  
  
  1.20      +9 -7      xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java
  
  Index: AxisServlet.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- AxisServlet.java	2001/05/22 05:25:35	1.19
  +++ AxisServlet.java	2001/06/10 19:57:24	1.20
  @@ -76,7 +76,7 @@
     public void init() {
         String param = getInitParameter("transport.input");
         ServletContext context = getServletConfig().getServletContext();
  -
  +      
         if (param == null)
             param = context.getInitParameter("transport.input");
         if (param != null)
  @@ -102,14 +102,12 @@
       ServletContext context = config.getServletContext();
       HttpSession    session = req.getSession();
   
  -    Handler  engine = null ;
  +    AxisEngine  engine = null ;
   
  -    //Debug.setDebugLevel( 6 );
  -
       /* Get or 'new' the Axis engine object */
       /***************************************/
       synchronized(context) {
  -      engine = (Handler) context.getAttribute( AXIS_ENGINE );
  +      engine = (AxisEngine) context.getAttribute( AXIS_ENGINE );
         if ( engine == null ) {
           engine = new AxisServer();
           engine.init();
  @@ -196,8 +194,12 @@
       /***********************************/
       msg = msgContext.getResponseMessage();
       res.setContentType( "text/xml" );
  -    String response = (String) msg.getAs("String");
  -    if (msg == null) response="No data";
  +    String response;
  +    if (msg == null) {
  +        response="No data";
  +    } else {
  +        response = (String)msg.getAs("String");
  +    }
       res.setContentLength( response.length() );
       res.getWriter().print( response );
     }
  
  
  
  1.9       +1 -1      xml-axis/java/src/org/apache/axis/transport/http/SimpleAxisServer.java
  
  Index: SimpleAxisServer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/http/SimpleAxisServer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SimpleAxisServer.java	2001/06/07 14:02:15	1.8
  +++ SimpleAxisServer.java	2001/06/10 19:57:24	1.9
  @@ -103,7 +103,7 @@
       // Axis specific constants
       private static String transportInName = "HTTPAction";
       private static String transportOutName = "HTTP.output";
  -    private static final String AXIS_ENGINE = "AxisEngine" ;
  +    //private static final String AXIS_ENGINE = "AxisEngine" ;
       
       // are we stopped?
       // latch to true if stop() is called
  
  
  
  1.8       +22 -8     xml-axis/java/test/RPCDispatch/TestRPC.java
  
  Index: TestRPC.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/RPCDispatch/TestRPC.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TestRPC.java	2001/06/07 14:02:26	1.7
  +++ TestRPC.java	2001/06/10 19:57:24	1.8
  @@ -36,13 +36,13 @@
       private Handler RPCDispatcher;
   
       private String SOAPAction = "urn:reverse";
  -    private String methodNS   = null;
  +    private String methodNS   = SOAPAction;
   
       public TestRPC(String name) {
           super(name);
           engine.init();
  -        hr = (HandlerRegistry) engine.getOption(Constants.HANDLER_REGISTRY);
  -        sr = (HandlerRegistry) engine.getOption(Constants.SERVICE_REGISTRY);
  +        hr = (HandlerRegistry) engine.getHandlerRegistry();
  +        sr = (HandlerRegistry) engine.getServiceRegistry();
           RPCDispatcher = hr.find("RPCDispatcher");
           // Debug.setDebugLevel(5);
       }
  @@ -53,7 +53,8 @@
        * @param request XML body of the request
        * @return Deserialized result
        */
  -    private final Object rpc(String method, Object[] parms)
  +    private final Object rpc(String method, Object[] parms,
  +                             boolean setService)
           throws AxisFault
       {
   
  @@ -70,7 +71,9 @@
           MessageContext msgContext = new MessageContext();
           msgContext.setProperty(Constants.SERVICE_REGISTRY, sr);
           msgContext.setRequestMessage(new Message(envelope, "SOAPEnvelope"));
  -        msgContext.setTargetService(SOAPAction);
  +        if (setService) {
  +            msgContext.setTargetService(SOAPAction);
  +        }
   
           // Invoke the Axis engine
           try {
  @@ -108,8 +111,19 @@
           reverse.addOption("methodName", "reverseString");
           sr.add(SOAPAction, reverse);
   
  +        // invoke the service and verify the result
  +        assertEquals("cba", rpc("reverseString", new Object[] {"abc"}, true));
  +    }
  +
  +    public void testReverseBodyDispatch() throws Exception {
  +        // Register the reverseString service
  +        SOAPService reverse = new SOAPService(RPCDispatcher, "RPCDispatcher");
  +        reverse.addOption("className", "test.RPCDispatch.Service");
  +        reverse.addOption("methodName", "reverseString");
  +        sr.add(SOAPAction, reverse);
  +
           // invoke the service and verify the result
  -        assertEquals("cba", rpc("reverseString", new Object[] {"abc"}));
  +        assertEquals("cba", rpc("reverseString", new Object[] {"abc"}, false));
       }
   
       /**
  @@ -125,7 +139,7 @@
           // invoke the service and verify the result
           Data input    = new Data(5, "abc", 3);
           Data expected = new Data(3, "cba", 5);
  -        assertEquals(expected, rpc("reverseData", new Object[] {input}));
  +        assertEquals(expected, rpc("reverseData", new Object[] {input}, true));
       }
   
       /**
  @@ -139,6 +153,6 @@
           sr.add(SOAPAction, reverse);
   
           // invoke the service and verify the result
  -        assertEquals(SOAPAction, rpc("targetService", new Object[] {}));
  +        assertEquals(SOAPAction, rpc("targetService", new Object[] {}, true));
       }
   }
  
  
  

Mime
View raw message