dims        2002/06/27 09:36:10

  Modified:    java/src/org/apache/axis/client AxisClient.java Call.java
               java/src/org/apache/axis AxisEngine.java
               java/src/org/apache/axis/utils axisNLS.properties
               java/test/functional TestJAXRPCSamples.java
               java/test/wsdl Wsdl2javaTestSuite.xml
  Added:       java/samples/jaxrpc/hello ClientHandler.java deploy.wsdd
                        Hello.java HelloBindingImpl.java HelloClient.java
                        HelloWorld.wsdl ServerHandler.java undeploy.wsdd
               java/src/org/apache/axis/handlers HandlerChainImpl.java
                        JAXRPCHandler.java
  Log:
  - Adding preliminary support for JAXRPC style client-side handlers and server-side 
handlers
  - Adding complete sample with both type of handlers.
  - Adding a testcase as usual.
  
  Revision  Changes    Path
  1.45      +13 -1     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.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- AxisClient.java   10 May 2002 16:06:30 -0000      1.44
  +++ AxisClient.java   27 Jun 2002 16:36:07 -0000      1.45
  @@ -62,11 +62,17 @@
   import org.apache.axis.Handler;
   import org.apache.axis.MessageContext;
   import org.apache.axis.SimpleTargetedChain;
  +import org.apache.axis.client.Call;
  +import org.apache.axis.client.Service;
  +import org.apache.axis.handlers.HandlerChainImpl;
   import org.apache.axis.handlers.soap.SOAPService;
   import org.apache.axis.utils.JavaUtils;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   
  +import javax.xml.rpc.handler.*;
  +import javax.xml.namespace.*;
  +
   /**
    * Provides the equivalent of an "Axis engine" on the client side.
    * Subclasses hardcode initialization & setup logic for particular
  @@ -163,6 +169,9 @@
                   if ((h = getGlobalRequest()) != null )
                       h.invoke(msgContext);
   
  +                /* Process the JAXRPC Handlers */
  +                invokeJAXRPCHandlers(msgContext);
  +
                   /** Process the Transport Specific stuff
                    *
                    * NOTE: Somewhere in here there is a handler which actually
  @@ -175,6 +184,9 @@
                   else
                       throw new AxisFault(JavaUtils.getMessage("noTransport00", 
hName));
   
  +                /* Process the JAXRPC Handlers */
  +                invokeJAXRPCHandlers(msgContext);
  +
                   /* Process the Global Response Chain */
                   /***********************************/
                   if ((h = getGlobalResponse()) != null)
  @@ -203,6 +215,6 @@
           if (log.isDebugEnabled()) {
               log.debug("Exit: AxisClient::invoke");
           }
  -    };
  +    }
   }
   
  
  
  
  1.148     +5 -0      xml-axis/java/src/org/apache/axis/client/Call.java
  
  Index: Call.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Call.java,v
  retrieving revision 1.147
  retrieving revision 1.148
  diff -u -r1.147 -r1.148
  --- Call.java 24 Jun 2002 17:47:50 -0000      1.147
  +++ Call.java 27 Jun 2002 16:36:07 -0000      1.148
  @@ -188,6 +188,8 @@
       public static final String SEND_TYPE_ATTR    = "send_type_attr" ;
       public static final String TRANSPORT_NAME    = "transport_name" ;
       public static final String TRANSPORT_PROPERTY= "java.protocol.handler.pkgs";
  +    public static final String JAXRPC_SERVICE    = "jaxrpc.service";
  +    public static final String JAXRPC_PORTTYPE_NAME = "jaxrpc.porttype.name";
   
       // If true, the code will throw a fault if there is no
       // response message from the server.  Otherwise, the
  @@ -1873,6 +1875,9 @@
           msgContext.reset();
           msgContext.setResponseMessage(null);
           msgContext.setProperty( MessageContext.CALL, this );
  +        msgContext.setProperty( JAXRPC_SERVICE, service );
  +        msgContext.setProperty( JAXRPC_PORTTYPE_NAME, getPortTypeName() );
  +
           if (username != null) {
               msgContext.setUsername(username);
           }
  
  
  
  1.81      +26 -1     xml-axis/java/src/org/apache/axis/AxisEngine.java
  
  Index: AxisEngine.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/AxisEngine.java,v
  retrieving revision 1.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- AxisEngine.java   11 Jun 2002 14:53:51 -0000      1.80
  +++ AxisEngine.java   27 Jun 2002 16:36:08 -0000      1.81
  @@ -405,4 +405,29 @@
       public static String getGlobalProperty(String property) {
           return System.getProperty(property);
       }
  -};
  +
  +    protected void invokeJAXRPCHandlers(MessageContext context){
  +        org.apache.axis.client.Service service = (org.apache.axis.client.Service) 
context.getProperty(org.apache.axis.client.Call.JAXRPC_SERVICE);
  +        if(service == null)
  +            return;
  +
  +        QName operationName = (QName) 
context.getProperty(org.apache.axis.client.Call.JAXRPC_PORTTYPE_NAME);
  +        if(operationName == null)
  +            return;
  +
  +        javax.xml.rpc.handler.HandlerRegistry registry = 
service.getHandlerRegistry();
  +        if(registry == null)
  +            return;
  +
  +        java.util.List chain = registry.getHandlerChain(operationName);
  +        if(chain == null || chain.isEmpty())
  +            return;
  +
  +        org.apache.axis.handlers.HandlerChainImpl impl = new 
org.apache.axis.handlers.HandlerChainImpl(chain);
  +        if(!context.getPastPivot())
  +            impl.handleRequest(context);
  +        else
  +            impl.handleResponse(context);
  +        impl.destroy();
  +    }
  +}
  
  
  
  1.16      +1 -0      xml-axis/java/src/org/apache/axis/utils/axisNLS.properties
  
  Index: axisNLS.properties
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/axisNLS.properties,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- axisNLS.properties        25 Jun 2002 13:55:58 -0000      1.15
  +++ axisNLS.properties        27 Jun 2002 16:36:08 -0000      1.16
  @@ -713,6 +713,7 @@
   AttrNotSimpleType01=Error: attribute is of type {0}, which is not a simple type
   NoSerializer00=Unable to find serializer for type {0}
   
  +NoJAXRPCHandler00=Unable to create handler of type {0}
   
   optionTypeMapping00=indicate 1.1 or 1.2.  The default is 1.2 (SOAP 1.2 JAX-RPC 
compliant)
   badTypeMappingOption00=The -typeMappingVersion argument must be 1.1 or 1.2
  
  
  
  1.1                  xml-axis/java/samples/jaxrpc/hello/ClientHandler.java
  
  Index: ClientHandler.java
  ===================================================================
  package samples.jaxrpc.hello;
  
  public class ClientHandler implements javax.xml.rpc.handler.Handler {
      public ClientHandler() {
      }
  
      public boolean handleRequest(javax.xml.rpc.handler.MessageContext context) {
          System.out.println("ClientHandler: In handleRequest");
          return true;
      }
  
      public boolean handleResponse(javax.xml.rpc.handler.MessageContext context) {
          System.out.println("ClientHandler: In handleResponse");
          return true;
      }
  
      public boolean handleFault(javax.xml.rpc.handler.MessageContext context) {
          System.out.println("ClientHandler: In handleFault");
          return true;
      }
  
      public void init(javax.xml.rpc.handler.HandlerInfo config) {
      }
  
      public void destroy() {
      }
  
      public javax.xml.namespace.QName[] getHeaders() {
          return null;
      }
  }
  
  
  
  
  1.1                  xml-axis/java/samples/jaxrpc/hello/deploy.wsdd
  
  Index: deploy.wsdd
  ===================================================================
  <!-- Use this file to deploy some handlers/chains and services      -->
  <!-- Two ways to do this:                                           -->
  <!--   java org.apache.axis.client.AdminClient deploy.wsdd          -->
  <!--      after the axis server is running                          -->
  <!-- or                                                             -->
  <!--   java org.apache.axis.utils.Admin client|server deploy.wsdd   -->
  <!--      from the same directory that the Axis engine runs         -->
  
  <deployment
      xmlns="http://xml.apache.org/axis/wsdd/";
      xmlns:java="http://xml.apache.org/axis/wsdd/providers/java";>
  
    <!-- Services from HelloWorld WSDL service -->
  
    <service name="HelloPort" provider="java:RPC">
        <parameter name="wsdlTargetNamespace" value="http://hello.jaxrpc.samples/"/>
        <parameter name="wsdlServiceElement" value="HelloWorld"/>
        <parameter name="wsdlServicePort" value="HelloPort"/>
        <parameter name="className" value="samples.jaxrpc.hello.HelloBindingImpl"/>
        <parameter name="wsdlPortType" value="Hello"/>
        <parameter name="scope" value="session"/>
        <operation name="sayHello" qname="operNS:sayHello" 
xmlns:operNS="http://hello.jaxrpc.samples/"; returnQName="result" >
          <parameter name="String_1" type="tns:string" 
xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
        </operation>
        <parameter name="allowedMethods" value="sayHello"/>
        <requestFlow>
         <handler type="java:org.apache.axis.handlers.JAXRPCHandler">
          <parameter name="scope" value="session"/>
          <parameter name="className" value="samples.jaxrpc.hello.ClientHandler"/>
         </handler>
        </requestFlow>
        <responseFlow>
         <handler type="java:org.apache.axis.handlers.JAXRPCHandler">
          <parameter name="scope" value="session"/>
          <parameter name="className" value="samples.jaxrpc.hello.ClientHandler"/>
         </handler>
        </responseFlow>
    </service>
  </deployment>
  
  
  
  1.1                  xml-axis/java/samples/jaxrpc/hello/Hello.java
  
  Index: Hello.java
  ===================================================================
  /**
   * Hello.java
   *
   * This file was auto-generated from WSDL
   * by the Apache Axis WSDL2Java emitter.
   */
  
  package samples.jaxrpc.hello;
  
  public interface Hello extends java.rmi.Remote {
      public java.lang.String sayHello(java.lang.String string1) throws 
java.rmi.RemoteException;
  }
  
  
  
  1.1                  xml-axis/java/samples/jaxrpc/hello/HelloBindingImpl.java
  
  Index: HelloBindingImpl.java
  ===================================================================
  /**
   * HelloBindingImpl.java
   *
   * This file was auto-generated from WSDL
   * by the Apache Axis WSDL2Java emitter.
   */
  
  package samples.jaxrpc.hello;
  
  public class HelloBindingImpl implements samples.jaxrpc.hello.Hello {
      public java.lang.String sayHello(java.lang.String name) throws 
java.rmi.RemoteException {
          return "A dynamic proxy hello to " + name + "!";
      }
  
  }
  
  
  
  1.1                  xml-axis/java/samples/jaxrpc/hello/HelloClient.java
  
  Index: HelloClient.java
  ===================================================================
  package samples.jaxrpc.hello;
  
  import javax.xml.namespace.QName;
  import javax.xml.rpc.Service;
  import javax.xml.rpc.ServiceFactory;
  import java.net.URL;
  
  public class HelloClient {
      public static void main(String[] args) throws Exception {
          String UrlString = "http://localhost:8080/axis/services/HelloPort?wsdl";;
          String nameSpaceUri = "http://hello.jaxrpc.samples/";;
          String serviceName = "HelloWorld";
          String portName = "HelloPort";
  
          URL helloWsdlUrl = new URL(UrlString);
          ServiceFactory serviceFactory = ServiceFactory.newInstance();
          Service helloService = serviceFactory.createService(helloWsdlUrl,
                  new QName(nameSpaceUri, serviceName));
  
          java.util.List list = helloService.getHandlerRegistry().getHandlerChain(new 
QName(nameSpaceUri, portName));
          list.add(new 
javax.xml.rpc.handler.HandlerInfo(ClientHandler.class,null,null));
  
          Hello myProxy = (Hello) helloService.getPort(
                  new QName(nameSpaceUri, portName),
                  samples.jaxrpc.hello.Hello.class);
  
          System.out.println(myProxy.sayHello("Buzz"));
      }
  }
  
  
  
  1.1                  xml-axis/java/samples/jaxrpc/hello/HelloWorld.wsdl
  
  Index: HelloWorld.wsdl
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <definitions name="HelloWorld"
  targetNamespace="http://hello.jaxrpc.samples/";
  xmlns:tns="http://hello.jaxrpc.samples/";
  xmlns="http://schemas.xmlsoap.org/wsdl/";
  xmlns:xsd="http://www.w3.org/2001/XMLSchema";
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";>
    <types />
  
    <message name="sayHello">
      <part name="String_1" type="xsd:string" />
    </message>
  
    <message name="sayHelloResponse">
      <part name="result" type="xsd:string" />
    </message>
  
    <portType name="Hello">
      <operation name="sayHello" parameterOrder="String_1">
        <input message="tns:sayHello" />
  
        <output message="tns:sayHelloResponse" />
      </operation>
    </portType>
  
    <binding name="HelloBinding" type="tns:Hello">
      <operation name="sayHello">
        <input>
          <soap:body
          encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
          use="encoded" namespace="http://hello.jaxrpc.samples/"; />
        </input>
  
        <output>
          <soap:body
          encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
          use="encoded" namespace="http://hello.jaxrpc.samples/"; />
        </output>
  
        <soap:operation soapAction="" />
      </operation>
  
      <soap:binding transport="http://schemas.xmlsoap.org/soap/http";
      style="rpc" />
    </binding>
  
    <service name="HelloWorld">
      <port name="HelloPort" binding="tns:HelloBinding">
        <soap:address
        location="http://localhost:8080/axis/Hello"; />
      </port>
    </service>
  </definitions>
  
  
  
  
  1.1                  xml-axis/java/samples/jaxrpc/hello/ServerHandler.java
  
  Index: ServerHandler.java
  ===================================================================
  package samples.jaxrpc.hello;
  
  public class ServerHandler implements javax.xml.rpc.handler.Handler {
      public ServerHandler() {
      }
  
      public boolean handleRequest(javax.xml.rpc.handler.MessageContext context) {
          System.out.println("ServerHandler: In handleRequest");
          return true;
      }
  
      public boolean handleResponse(javax.xml.rpc.handler.MessageContext context) {
          System.out.println("ServerHandler: In handleResponse");
          return true;
      }
  
      public boolean handleFault(javax.xml.rpc.handler.MessageContext context) {
          System.out.println("ServerHandler: In handleFault");
          return true;
      }
  
      public void init(javax.xml.rpc.handler.HandlerInfo config) {
      }
  
      public void destroy() {
      }
  
      public javax.xml.namespace.QName[] getHeaders() {
          return null;
      }
  }
  
  
  
  
  1.1                  xml-axis/java/samples/jaxrpc/hello/undeploy.wsdd
  
  Index: undeploy.wsdd
  ===================================================================
  <!-- Use this file to undeploy some handlers/chains and services    -->
  <!-- Two ways to do this:                                           -->
  <!--   java org.apache.axis.client.AdminClient undeploy.wsdd        -->
  <!--      after the axis server is running                          -->
  <!-- or                                                             -->
  <!--   java org.apache.axis.utils.Admin client|server undeploy.wsdd -->
  <!--      from the same directory that the Axis engine runs         -->
  
  <undeployment
      xmlns="http://xml.apache.org/axis/wsdd/";>
  
    <!-- Services from HelloWorld WSDL service -->
  
    <service name="HelloPort"/>
  </undeployment>
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/handlers/HandlerChainImpl.java
  
  Index: HandlerChainImpl.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 [EMAIL PROTECTED]
   *
   * 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.handlers;
  
  import org.apache.axis.utils.ClassUtils;
  import org.apache.axis.utils.JavaUtils;
  
  import javax.xml.rpc.JAXRPCException;
  import javax.xml.rpc.handler.Handler;
  import javax.xml.rpc.handler.HandlerInfo;
  import javax.xml.rpc.handler.MessageContext;
  import javax.xml.rpc.handler.soap.SOAPMessageContext;
  import javax.xml.rpc.soap.SOAPFaultException;
  import java.util.ArrayList;
  import java.util.List;
  
  public class HandlerChainImpl extends ArrayList {
      protected List handlerInfos = new ArrayList();
      String[] roles = null;
  
      public HandlerChainImpl() {
      }
  
      public HandlerChainImpl(List handlerInfos) {
          this.handlerInfos = handlerInfos;
          for (int i = 0; i < handlerInfos.size(); i++)
              add(newHandler(getHandlerInfo(i)));
      }
  
      public void addNewHandler(String className) {
          try {
              HandlerInfo handlerInfo = new HandlerInfo(ClassUtils.forName(className), 
null, null);
              handlerInfos.add(handlerInfo);
              add(newHandler(handlerInfo));
          } catch (Exception ex) {
              String messageText = JavaUtils.getMessage("NoJAXRPCHandler00", 
className);
              throw new JAXRPCException(messageText, ex);
          }
      }
  
      public boolean handleFault(MessageContext _context) {
          SOAPMessageContext context = (SOAPMessageContext) _context;
  
          for (int i = size() - 1; i >= 0; i--)
              if (getHandlerInstance(i).handleFault(context) == false)
                  return false;
          return true;
      }
  
      public boolean handleRequest(MessageContext _context) {
          SOAPMessageContext context = (SOAPMessageContext) _context;
  
          boolean processFault = false;
  
          for (int i = 0; i < size(); i++) {
              Handler currentHandler = getHandlerInstance(i);
              try {
                  if (currentHandler.handleRequest(context) == false) {
                      return false;
                  }
              } catch (SOAPFaultException sfe) {
                  throw sfe;
              }
          }
          return true;
      }
  
      public boolean handleResponse(MessageContext context) {
          for (int i = size() - 1; i >= 0; i--)
              if (getHandlerInstance(i).handleResponse(context) == false)
                  return false;
          return true;
      }
  
      public void destroy() {
          for (int i = 0; i < size(); i++)
              getHandlerInstance(i).destroy();
          clear();
      }
  
      private Handler getHandlerInstance(int index) {
          return (Handler) get(index);
      }
  
      private HandlerInfo getHandlerInfo(int index) {
          return (HandlerInfo) handlerInfos.get(index);
      }
  
      private Handler newHandler(HandlerInfo handlerInfo) {
          try {
              Handler handler =
                      (Handler) handlerInfo.getHandlerClass().newInstance();
              handler.init(handlerInfo);
              return handler;
          } catch (Exception ex) {
              String messageText = JavaUtils.getMessage("NoJAXRPCHandler00", 
handlerInfo.getHandlerClass().toString());
              throw new JAXRPCException(messageText, ex);
          }
      }
  }
  
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/handlers/JAXRPCHandler.java
  
  Index: JAXRPCHandler.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 [EMAIL PROTECTED]
   *
   * 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.handlers;
  
  import org.apache.axis.AxisFault;
  import org.apache.axis.MessageContext;
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  
  
  /**
   * Handles JAXRPC style handlers.
   * @author Davanum Srinivas ([EMAIL PROTECTED])
   */
  public class JAXRPCHandler extends BasicHandler {
      protected static Log log =
              LogFactory.getLog(JAXRPCHandler.class.getName());
  
      HandlerChainImpl impl = null;
  
      public void invoke(MessageContext msgContext) throws AxisFault {
          log.debug("Enter: JAXRPCHandler::enter invoke");
          if (impl == null) {
              String className = (String) getOption("className");
              impl = new HandlerChainImpl();
              impl.addNewHandler(className);
          }
          if (!msgContext.getPastPivot()) {
              impl.handleRequest(msgContext);
          } else {
              impl.handleResponse(msgContext);
          }
          log.debug("Enter: JAXRPCHandler::exit invoke");
      }
  
      public void onFault(MessageContext msgContext) {
          impl.handleFault(msgContext);
      }
  
      public void cleanup() {
          impl.destroy();
      }
  }
  
  
  
  1.4       +13 -2     xml-axis/java/test/functional/TestJAXRPCSamples.java
  
  Index: TestJAXRPCSamples.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/functional/TestJAXRPCSamples.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestJAXRPCSamples.java    19 Jun 2002 19:11:50 -0000      1.3
  +++ TestJAXRPCSamples.java    27 Jun 2002 16:36:09 -0000      1.4
  @@ -139,10 +139,21 @@
           }
       } // testGetInfo
   
  +    public void testHello() throws Exception {
  +        try {
  +            log.info("Testing JAX-RPC hello sample.");
  +            samples.jaxrpc.hello.HelloClient.main(new String[]{});
  +            log.info("Test complete.");
  +        }
  +        catch (Throwable t) {
  +            t.printStackTrace();
  +            throw new Exception("Fault returned from test: " + t);
  +        }
  +    }
  +
       public static void main(String args[]) throws Exception {
           TestJAXRPCSamples tester = new TestJAXRPCSamples("tester");
  -        tester.testGetQuote();
  -        tester.testGetInfo();
  +        tester.testHello();
       } // main
   }
   
  
  
  
  1.109     +7 -0      xml-axis/java/test/wsdl/Wsdl2javaTestSuite.xml
  
  Index: Wsdl2javaTestSuite.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/Wsdl2javaTestSuite.xml,v
  retrieving revision 1.108
  retrieving revision 1.109
  diff -u -r1.108 -r1.109
  --- Wsdl2javaTestSuite.xml    26 Jun 2002 21:23:52 -0000      1.108
  +++ Wsdl2javaTestSuite.xml    27 Jun 2002 16:36:10 -0000      1.109
  @@ -905,6 +905,13 @@
           <mapping namespace="http://echo.services"; package="test.wsdl.echo"/>
           <mapping namespace="http://types.echo.services"; package="test.wsdl.echo"/>
       </wsdl2java>
  +
  +    <!-- jaxrpc sample -->
  +    <wsdl2java url="samples/jaxrpc/hello/HelloWorld.wsdl"
  +               output="build/work"
  +               serverSide="yes"
  +               testcase="no">
  +    </wsdl2java>
       
       <!-- The following WSDL are BAD.  We're keeping them here so we can -->
       <!-- check periodically to see whether the owner has fixed them.    -->
  
  
  


Reply via email to