axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: xml-axis/java/test/functional/ant RunAxisFunctionalTestsTask.java
Date Thu, 31 May 2001 09:25:26 GMT
robj        01/05/31 02:25:26

  Modified:    java     build.xml
               java/samples/bidbuy TestClient.java v3.java vInterface.java
               java/samples/echo TestClient.java
               java/samples/misc TestClient.java
               java/samples/stock GetInfo.java GetQuote.java deploy.xml
                        testit.cmd testit.sh
               java/samples/transport FileTest.java
               java/src/org/apache/axis MessageContext.java
               java/src/org/apache/axis/client AxisClient.java
               java/src/org/apache/axis/deployment/v2dd
                        V2DDDeployableItem.java V2DDProvider.java
               java/src/org/apache/axis/deployment/v2dd/providers
                        V2DDComProvider.java V2DDJavaProvider.java
                        V2DDScriptProvider.java
               java/src/org/apache/axis/deployment/wsdd/providers
                        WSDDBsfProvider.java WSDDComProvider.java
                        WSDDJavaProvider.java
               java/src/org/apache/axis/handlers JWSProcessor.java
               java/src/org/apache/axis/registries
                        DefaultHandlerRegistry.java
               java/src/org/apache/axis/transport/http
                        SimpleAxisServer.java
               java/src/org/apache/axis/utils Admin.java
  Added:       java/src/org/apache/axis/handlers/tcp TCPActionHandler.java
               java/src/org/apache/axis/transport/tcp AxisListener.java
                        PseudoStockQuoteService.java
                        TCPDispatchHandler.java
               java/src/org/apache/axis/providers BasicProvider.java
                        BSFProvider.java ComProvider.java JWSProvider.java
               java/src/org/apache/axis/providers/java JavaProvider.java
                        MsgProvider.java RPCProvider.java
               java/test build_ant.xml build_functional_tests.xml
               java/test/functional FunctionalTests.java TestHTTPEcho.java
                        TestTCPEcho.java
               java/test/functional/ant RunAxisFunctionalTestsTask.java
  Removed:     java/src/org/apache/axis/client AdminClient.java
                        HTTPCall.java HTTPMessage.java
               java/src/org/apache/axis/handlers MsgDispatchHandler.java
                        RPCDispatchHandler.java
               java/src/org/apache/axis/handlers/providers BSFProvider.java
                        BasicProvider.java ComProvider.java
                        JWSProvider.java JavaProvider.java readme
  Log:
  I hope I will never have to make another checkin as large
  as this.  Changes include:
  - tcp transport (probably already deprecated)
  - generic ServiceClient replaces (HTTP-specific) HTTPCall
  - functional test suite exercises client-server HTTP and TCP
    (do "java org.apache.tools.ant.Main functional-tests")
  - providers moved to toplevel directory
  - MsgDispatchHandler, RPCDispatchHandler refactored
    into MsgProvider, RPCProvider
  - and more besides....
  There may well be problems.  I apologize in advance.
  Feel free to call me, 415 861 2606, to work them out
  absolutely ASAP tomorrow (today? :-).
  
  Revision  Changes    Path
  1.23      +44 -4     xml-axis/java/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/build.xml,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- build.xml	2001/05/22 23:32:41	1.22
  +++ build.xml	2001/05/31 09:22:20	1.23
  @@ -25,6 +25,7 @@
    - javadocs -> creates the javadocs in "./build/javadocs"
    - dist     -> creates the complete binary distribution
    - srcdist  -> creates the complete src distribution
  + - functional-tests -> attempts to build Ant task and then run client-server functional test
   
   Custom post-compilation work:
   
  @@ -99,7 +100,7 @@
         classname="javax.servlet.Servlet"
         classpathref="classpath"/>
   
  -    <available property="junit.present" 
  +    <available property="junit.present"
         classname="junit.framework.TestCase"
         classpathref="classpath"/>
   
  @@ -154,7 +155,7 @@
     <!-- Compiles the samples                                                -->
     <!-- =================================================================== -->
     <target name="samples" depends="compile">
  -    <javac srcdir="." destdir="${build.dest}" 
  +    <javac srcdir="." destdir="${build.dest}"
              classpath="${build.lib}/${name}.jar" debug="${debug}">
         <include name="samples/**/*.java" />
         <exclude name="samples/**/*SMTP*.java" unless="smtp.present" />
  @@ -190,7 +191,7 @@
   
   
     <!-- =================================================================== -->
  -  <!-- Runs the JUnit testcases -->
  +  <!-- Runs the JUnit package testcases -->
     <!-- =================================================================== -->
     <target name="junit" if="junit.present" depends="buildTest">
       <mkdir dir="${basedir}/test-reports" />
  @@ -206,11 +207,50 @@
         </batchtest>
       </junit>
     </target>
  +  
  +  <!-- =================================================================== -->
  +  <!-- Functional tests, no dependencies (for no-build testing)            -->
  +  <!-- =================================================================== -->
  +  <target name="functional-tests-only" depends="setenv">
  +  
  +    <!-- The Axis Ant task must be built (into ANT_HOME/lib)... -->
  +    <ant antfile="test/build_ant.xml" />
  +    
  +    <!--
  +    ...and then the functional tests can be run.  If this step yields a
  +    "can't find class test.functional.ant.RunAxisFunctionalTestsTask",
  +    verify that your Ant classpath contains ANT_HOME/lib.
  +    -->
  +    <ant antfile="test/build_functional_tests.xml" />
  +    
  +  </target>
   
     <!-- =================================================================== -->
  -  <!-- Creates the API documentation                                       -->
  +  <!-- Functional tests, no server (for testing under debugger)            -->
  +  <!-- =================================================================== -->
  +  <target name="functional-tests-noserver" depends="setenv">
  +  
  +    <!-- The Axis Ant task must be built (into ANT_HOME/lib)... -->
  +    <ant antfile="test/build_ant.xml" />
  +    
  +    <!--
  +    ...and then the functional tests can be run.  If this step yields a
  +    "can't find class test.functional.ant.RunAxisFunctionalTestsTask",
  +    verify that your Ant classpath contains ANT_HOME/lib.
  +    -->
  +    <ant antfile="test/build_functional_tests.xml" target="junit-functional-noserver"/>
  +    
  +  </target>
  +
  +  <!-- =================================================================== -->
  +  <!-- After junit, functional tests, if explicitly invoked                -->
     <!-- =================================================================== -->
  +  <target name="functional-tests" depends="junit, samples, functional-tests-only">
  +  </target>
   
  +  <!-- =================================================================== -->
  +  <!-- Creates the API documentation                                       -->
  +  <!-- =================================================================== -->
     <target name="javadocs" depends="setenv" unless="javadoc.notrequired">
       <mkdir dir="${build.javadocs}"/>
       <javadoc packagenames="${packages}"
  
  
  
  1.2       +8 -5      xml-axis/java/samples/bidbuy/TestClient.java
  
  Index: TestClient.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/bidbuy/TestClient.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestClient.java	2001/05/09 19:19:52	1.1
  +++ TestClient.java	2001/05/31 09:22:30	1.2
  @@ -60,7 +60,8 @@
   import java.util.Date;
   
   import org.apache.axis.AxisFault ;
  -import org.apache.axis.client.HTTPCall ;
  +import org.apache.axis.client.ServiceClient ;
  +import org.apache.axis.client.http.HTTPClient ;
   import org.apache.axis.encoding.BeanSerializer;
   import org.apache.axis.encoding.SOAPTypeMappingRegistry;
   import org.apache.axis.encoding.ServiceDescription;
  @@ -78,7 +79,7 @@
    */
   public class TestClient {
   
  -    private static HTTPCall call;
  +    private static ServiceClient call;
       private static TypeMappingRegistry map = new SOAPTypeMappingRegistry();
   
       /**
  @@ -102,10 +103,12 @@
           // set up the call object
           Options opts = new Options(args);
           Debug.setDebugLevel( opts.isFlagSet( 'd' ) );
  -        call = new HTTPCall(opts.getURL(), "http://www.soapinterop.org/Buy");
  +        call = new ServiceClient(new HTTPClient());
  +        call.set(HTTPClient.URL, opts.getURL());
  +        call.set(HTTPClient.ACTION, "http://www.soapinterop.org/Buy");
   
           // register the PurchaseOrder class
  -        QName poqn = new QName("http://www.soapinterop.org/Bid", 
  +        QName poqn = new QName("http://www.soapinterop.org/Bid",
                                  "PurchaseOrder");
           Class cls = PurchaseOrder.class;
           call.addSerializer(cls, poqn, new BeanSerializer(cls));
  @@ -144,7 +147,7 @@
   
               // issue the request
               String receipt = (String) call.invoke(
  -                "http://www.soapinterop.org/Bid", "Buy", 
  +                "http://www.soapinterop.org/Bid", "Buy",
                   new Object[] {new RPCParam("PO", po)} );
   
               System.out.println(receipt);
  
  
  
  1.4       +39 -31    xml-axis/java/samples/bidbuy/v3.java
  
  Index: v3.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/bidbuy/v3.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- v3.java	2001/05/10 18:00:28	1.3
  +++ v3.java	2001/05/31 09:22:33	1.4
  @@ -1,6 +1,7 @@
   package samples.bidbuy ;
   
  -import org.apache.axis.client.HTTPCall ;
  +import org.apache.axis.client.ServiceClient ;
  +import org.apache.axis.client.http.HTTPClient ;
   import org.apache.axis.message.RPCElement ;
   import org.apache.axis.message.RPCParam ;
   import org.apache.axis.utils.* ;
  @@ -12,8 +13,9 @@
   public class v3 implements vInterface {
     public void register(String registryURL, Service s) throws Exception {
       try {
  -      HTTPCall call = new HTTPCall( registryURL, 
  -                                    "http://www.soapinterop.org/Register" );
  +      ServiceClient call = new ServiceClient(new HTTPClient());
  +      call.set(HTTPClient.URL, registryURL);
  +      call.set(HTTPClient.ACTION, "http://www.soapinterop.org/Register");
         RPCElement body = new RPCElement( "http://www.soapinterop.org/Registry",
                                           "Register",
                                           new RPCParam[] {
  @@ -35,8 +37,9 @@
   
     public void unregister(String registryURL, String name) throws Exception {
       try {
  -      HTTPCall call = new HTTPCall( registryURL, 
  -                                    "http://www.soapinterop.org/Unregister" );
  +      ServiceClient call = new ServiceClient(new HTTPClient());
  +      call.set(HTTPClient.URL, registryURL);
  +      call.set(HTTPClient.ACTION, "http://www.soapinterop.org/Unegister");
         RPCElement body = new RPCElement( "http://www.soapinterop.org/Registry",
                                           "Unregister",
                                           new RPCParam[] {
  @@ -52,8 +55,9 @@
   
     public Boolean ping(String serverURL) throws Exception {
       try {
  -      HTTPCall call = new HTTPCall( serverURL,
  -                                    "http://www.soapinterop.org/Ping" );
  +      ServiceClient call = new ServiceClient(new HTTPClient());
  +      call.set(HTTPClient.URL, serverURL);
  +      call.set(HTTPClient.ACTION, "http://www.soapinterop.org/Ping");
         call.invoke( "http://www.soapinterop.org/Bid", "Ping", null );
         return( new Boolean(true) );
       }
  @@ -63,19 +67,20 @@
       }
     }
   
  -  public Vector lookupAsString(String registryURL) throws Exception 
  +  public Vector lookupAsString(String registryURL) throws Exception
     {
       try {
         ServiceDescription sd = new ServiceDescription("lookup", true );
  -      sd.addOutputParam("RequestForQuoteResult", 
  +      sd.addOutputParam("RequestForQuoteResult",
                           SOAPTypeMappingRegistry.XSD_DOUBLE);
  -      HTTPCall call = new HTTPCall( registryURL,
  -                                  "http://www.soapinterop.org/LookupAsString" );
  +      ServiceClient call = new ServiceClient(new HTTPClient());
  +      call.set(HTTPClient.URL, registryURL);
  +      call.set(HTTPClient.ACTION, "http://www.soapinterop.org/LookupAsString");
         call.setServiceDescription(sd);
         RPCElement body = new RPCElement( "http://www.soapinterop.org/Registry",
                                           "LookupAsString",
                                           new RPCParam[] {
  -                                          new RPCParam("ServiceType", 
  +                                          new RPCParam("ServiceType",
                                                          "Bid") } );
         String res = (String) call.invoke( body );
         if ( res == null ) return( null );
  @@ -115,19 +120,20 @@
         ServiceDescription sd = new ServiceDescription("RequestForQuote", true );
         sd.addOutputParam("RequestForQuoteResult",
                           SOAPTypeMappingRegistry.XSD_DOUBLE);
  -      sd.addOutputParam("Result", 
  +      sd.addOutputParam("Result",
                           SOAPTypeMappingRegistry.XSD_DOUBLE);
  -      sd.addOutputParam("return", 
  +      sd.addOutputParam("return",
                           SOAPTypeMappingRegistry.XSD_DOUBLE);
  -      HTTPCall call = new HTTPCall( serverURL,
  -                                  "http://www.soapinterop.org/RequestForQuote");
  +      ServiceClient call = new ServiceClient(new HTTPClient());
  +      call.set(HTTPClient.URL, serverURL);
  +      call.set(HTTPClient.ACTION, "http://www.soapinterop.org/RequestForQuote");
         call.setServiceDescription( sd );
         RPCElement body = new RPCElement( "http://www.soapinterop.org/Bid",
                                           "RequestForQuote",
                                           new RPCParam[] {
                                             new RPCParam( "ProductName",
                                                           "widget"),
  -                                          new RPCParam( "Quantity", 
  +                                          new RPCParam( "Quantity",
                                                           new Integer(10) ) } );
         Object r = call.invoke( body );
         if ( r instanceof Float ) r = ((Float)r).toString();
  @@ -146,14 +152,15 @@
         ServiceDescription sd = new ServiceDescription("SimpleBuy", true );
         sd.addOutputParam("SimpleBuyResult",
                           SOAPTypeMappingRegistry.XSD_STRING);
  -      sd.addOutputParam("Result", 
  +      sd.addOutputParam("Result",
                           SOAPTypeMappingRegistry.XSD_STRING);
  -      sd.addOutputParam("return", 
  +      sd.addOutputParam("return",
                           SOAPTypeMappingRegistry.XSD_STRING);
  -      HTTPCall call = new HTTPCall( serverURL,
  -                                  "http://www.soapinterop.org/SimpleBuy" );
  +      ServiceClient call = new ServiceClient(new HTTPClient());
  +      call.set(HTTPClient.URL, serverURL);
  +      call.set(HTTPClient.ACTION, "http://www.soapinterop.org/SimpleBuy");
         RPCElement  body = new RPCElement( "http://www.soapinterop.org/Bid",
  -                                         "SimpleBuy", 
  +                                         "SimpleBuy",
                                            new RPCParam[] {
                                              new RPCParam("Address",
                                                           "123 Main St."),
  @@ -170,20 +177,21 @@
       }
     }
   
  -  public String buy(String serverURL, int quantity, int numItems, double price) 
  -      throws Exception 
  +  public String buy(String serverURL, int quantity, int numItems, double price)
  +      throws Exception
     {
       try {
  -      int      i ; 
  +      int      i ;
         ServiceDescription sd = new ServiceDescription("SimpleBuy", true );
         sd.addOutputParam("BuyResult",
                           SOAPTypeMappingRegistry.XSD_STRING);
  -      sd.addOutputParam("Result", 
  +      sd.addOutputParam("Result",
                           SOAPTypeMappingRegistry.XSD_STRING);
  -      sd.addOutputParam("return", 
  +      sd.addOutputParam("return",
                           SOAPTypeMappingRegistry.XSD_STRING);
  -      HTTPCall call = new HTTPCall( serverURL,
  -                                  "http://www.soapinterop.org/Buy" );
  +      ServiceClient call = new ServiceClient(new HTTPClient());
  +      call.set(HTTPClient.URL, serverURL);
  +      call.set(HTTPClient.ACTION, "http://www.soapinterop.org/Buy");
   
   
         // register the PurchaseOrder class
  @@ -211,7 +219,7 @@
         for ( i = 0 ; i < numItems ; i++ )
           lineItems[i] = new LineItem("Widget"+i,quantity,new BigDecimal(price));
   
  -      PurchaseOrder  po = new PurchaseOrder( "PO1", 
  +      PurchaseOrder  po = new PurchaseOrder( "PO1",
                                                new Date(),
                                                new Address("Mr Big",
                                                            "40 Wildwood Lane",
  @@ -226,7 +234,7 @@
                                                lineItems );
   
         RPCElement  body = new RPCElement( "http://www.soapinterop.org/Bid",
  -                                         "Buy", 
  +                                         "Buy",
                                            new RPCParam[]{
                                              new RPCParam("PO",
                                                           po)} );
  
  
  
  1.4       +0 -1      xml-axis/java/samples/bidbuy/vInterface.java
  
  Index: vInterface.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/bidbuy/vInterface.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- vInterface.java	2001/05/10 18:00:30	1.3
  +++ vInterface.java	2001/05/31 09:22:35	1.4
  @@ -1,6 +1,5 @@
   package samples.bidbuy ;
   
  -import org.apache.axis.client.HTTPCall ;
   import org.apache.axis.message.RPCElement ;
   import org.apache.axis.message.RPCParam ;
   import org.apache.axis.utils.* ;
  
  
  
  1.5       +8 -5      xml-axis/java/samples/echo/TestClient.java
  
  Index: TestClient.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/echo/TestClient.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestClient.java	2001/05/22 15:22:06	1.4
  +++ TestClient.java	2001/05/31 09:22:40	1.5
  @@ -59,7 +59,8 @@
   import java.util.Hashtable;
   
   import org.apache.axis.AxisFault ;
  -import org.apache.axis.client.HTTPCall ;
  +import org.apache.axis.client.ServiceClient ;
  +import org.apache.axis.client.http.HTTPClient ;
   import org.apache.axis.encoding.BeanSerializer;
   import org.apache.axis.encoding.SOAPTypeMappingRegistry;
   import org.apache.axis.encoding.ServiceDescription;
  @@ -76,13 +77,13 @@
    */
   public class TestClient {
   
  -    private static HTTPCall call;
  +    private static ServiceClient call;
       private static TypeMappingRegistry map = new SOAPTypeMappingRegistry();
       private static boolean addMethodToAction = false;
       private static String soapAction = "http://soapinterop.org/";
   
       /**
  -     * 
  +     *
        */
       private static boolean equals(Object obj1, Object obj2) {
          if (obj1 == null) return (obj2 == null);
  @@ -119,7 +120,7 @@
               if (addMethodToAction) {
                   action += method;
               }
  -            call.setAction(action);
  +            call.set(HTTPClient.ACTION, action);
   
               // issue the request
               Object gotBack = call.invoke(
  @@ -153,7 +154,9 @@
           if (action != null)
               soapAction = action;
           
  -        call = new HTTPCall(opts.getURL(), "http://soapinterop.org/");
  +        call = new ServiceClient(new HTTPClient());
  +        call.set(HTTPClient.URL, opts.getURL());
  +        call.set(HTTPClient.ACTION, "http://soapinterop.org/");
   
           // register the SOAPStruct class
           QName ssqn = new QName("http://soapinterop.org/xsd", "SOAPStruct");
  
  
  
  1.4       +9 -6      xml-axis/java/samples/misc/TestClient.java
  
  Index: TestClient.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/misc/TestClient.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestClient.java	2001/03/08 01:15:09	1.3
  +++ TestClient.java	2001/05/31 09:22:45	1.4
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 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 
  + *    software without prior written permission. For written
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -62,7 +62,8 @@
   import org.apache.axis.*;
   import org.apache.axis.utils.Debug ;
   import org.apache.axis.utils.Options ;
  -import org.apache.axis.client.HTTPMessage ;
  +import org.apache.axis.client.ServiceClient ;
  +import org.apache.axis.client.http.HTTPClient ;
   
   /**
    *
  @@ -81,7 +82,9 @@
         args = opts.getRemainingArgs();
         if ( args != null ) action = args[0];
   
  -      HTTPMessage  hMsg    = new HTTPMessage( url, action );
  +      ServiceClient hMsg = new ServiceClient(new HTTPClient());
  +      hMsg.set(HTTPClient.URL, url);
  +      hMsg.set(HTTPClient.ACTION, action);
   
         if ( opts.isFlagSet('t') > 0 ) hMsg.doLocal = true ;
   
  
  
  
  1.6       +17 -13    xml-axis/java/samples/stock/GetInfo.java
  
  Index: GetInfo.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/stock/GetInfo.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- GetInfo.java	2001/04/27 01:10:19	1.5
  +++ GetInfo.java	2001/05/31 09:22:50	1.6
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 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 
  + *    software without prior written permission. For written
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -62,9 +62,10 @@
   import org.apache.axis.AxisFault ;
   import org.apache.axis.utils.Debug ;
   import org.apache.axis.utils.Options ;
  -import org.apache.axis.client.HTTPCall ;
  +import org.apache.axis.client.ServiceClient ;
  +import org.apache.axis.client.http.HTTPClient ;
   
  -/** 
  +/**
    *
    * @author Doug Davis (dug@us.ibm.com.com)
    */
  @@ -84,14 +85,16 @@
         }
   
         String  symbol = args[0] ;
  -      HTTPCall call = new HTTPCall( opts.getURL(), "urn:cominfo" );
  +      ServiceClient call = new ServiceClient(new HTTPClient());
  +      call.set(HTTPClient.URL, opts.getURL());
  +      call.set(HTTPClient.ACTION, "urn:cominfo");
   
         if ( opts.isFlagSet('t') > 0 ) call.doLocal = true ;
   
  -      call.setUserID( opts.getUser() );
  -      call.setPassword( opts.getPassword() );
  -      String res = (String) call.invoke( 
  -        "http://schemas.xmlsoap.org/soap/envelope/", "getInfo",
  +      call.set( HTTPClient.USER, opts.getUser() );
  +      call.set( HTTPClient.PASSWORD, opts.getPassword() );
  +      String res = (String) call.invoke(
  +        "urn:cominfo", "getInfo",
           new Object[] { args[0], args[1] } );
         
         System.out.println( symbol + ": " + res );
  @@ -100,6 +103,7 @@
         if ( e instanceof AxisFault ) ((AxisFault)e).dump();
         else e.printStackTrace();
       }
  -  };
  +  }
   
  -};
  +}
  +
  
  
  
  1.18      +36 -18    xml-axis/java/samples/stock/GetQuote.java
  
  Index: GetQuote.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/stock/GetQuote.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- GetQuote.java	2001/05/04 06:28:20	1.17
  +++ GetQuote.java	2001/05/31 09:22:52	1.18
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 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 
  + *    software without prior written permission. For written
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -60,22 +60,22 @@
   import java.util.*;
   
   import org.apache.axis.AxisFault ;
  -import org.apache.axis.client.HTTPCall ;
  +import org.apache.axis.client.ServiceClient ;
  +import org.apache.axis.client.http.HTTPClient ;
   import org.apache.axis.utils.Debug ;
   import org.apache.axis.utils.Options ;
   import org.apache.axis.utils.QName ;
   import org.apache.axis.encoding.ServiceDescription;
   import org.apache.axis.encoding.SOAPTypeMappingRegistry;
   
  -/** 
  +/**
    *
    * @author Doug Davis (dug@us.ibm.com.com)
    */
   public class GetQuote {
  -
  -  public static void main(String args[]) {
  -
  -    try {
  +    
  +  // helper function; does all the real work
  +    public float getQuote (String args[]) throws Exception {
         Options opts = new Options( args );
   
         Debug.setDebugLevel( opts.isFlagSet( 'd' ) );
  @@ -87,17 +87,19 @@
           System.exit(1);
         }
   
  +      String action = "urn:xmltoday-delayed-quotes";
         String   symbol = args[0] ;
  -      HTTPCall call   = new HTTPCall( opts.getURL(), 
  -                                      "urn:xmltoday-delayed-quotes" );
  +      ServiceClient call = new ServiceClient(new HTTPClient());
  +      call.set(HTTPClient.URL, opts.getURL());
  +      call.set(HTTPClient.ACTION, action);
         ServiceDescription sd = new ServiceDescription("stockQuotes", true);
         sd.addOutputParam("return", SOAPTypeMappingRegistry.XSD_FLOAT);
         call.setServiceDescription(sd);
         
         if ( opts.isFlagSet('t') > 0 ) call.doLocal = true ;
   
  -      call.setUserID( opts.getUser() );
  -      call.setPassword( opts.getPassword() );
  +      call.set( HTTPClient.USER, opts.getUser() );
  +      call.set( HTTPClient.PASSWORD, opts.getPassword() );
   
         // useful option for profiling - perhaps we should remove before
         // shipping?
  @@ -110,17 +112,33 @@
   
         Float res = new Float(0.0F);
         for (int i=0; i<count; i++) {
  -        res = (Float) call.invoke( 
  -          "http://schemas.xmlsoap.org/soap/envelope/", "getQuote",
  -          new Object[] {symbol} );
  +        // the namespace of the call should be the service.
  +        // ...according to Glen... -- RobJ
  +          Object ret = call.invoke(
  +          action, "getQuote", new Object[] {symbol} );
  +          if (ret instanceof String) {
  +              System.out.println("Received problem response from server: "+ret);
  +              throw new AxisFault("", (String)ret, null, null);
  +          }
  +        res = (Float) ret;
         }
   
  -      System.out.println( symbol + ": " + res );
  +        return res.floatValue();
  +    }
  +
  +  public static void main(String args[]) {
  +    try {
  +        float val = new GetQuote().getQuote(args);
  +        // args array gets side-effected
  +        System.out.println(args[0] + ": " + val);
       }
       catch( Exception e ) {
         if ( e instanceof AxisFault ) ((AxisFault)e).dump();
         e.printStackTrace();
       }
  +  }
  +  
  +  public GetQuote () {
     };
   
   };
  
  
  
  1.8       +1 -1      xml-axis/java/samples/stock/deploy.xml
  
  Index: deploy.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/stock/deploy.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- deploy.xml	2001/05/10 22:49:29	1.7
  +++ deploy.xml	2001/05/31 09:22:55	1.8
  @@ -3,7 +3,7 @@
   <!--   java org.apache.axis.utils.Admin deploy.xml              -->
   <!--      from the same dir that the Axis engine runs           -->
   <!-- or                                                         -->
  -<!--   java org.apache.axis.client.AdminClient deploy.xml       -->
  +<!--   java org.apache.axis.client.http.AdminClient deploy.xml  -->
   <!--      after the axis server is running                      -->
   <!-- This file will be replaced by WSDD once it's ready         -->
   
  
  
  
  1.6       +4 -2      xml-axis/java/samples/stock/testit.cmd
  
  Index: testit.cmd
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/stock/testit.cmd,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- testit.cmd	2001/04/22 19:29:12	1.5
  +++ testit.cmd	2001/05/31 09:22:57	1.6
  @@ -1,10 +1,12 @@
   rem this assumes webserver is running on port 8080
   
  +set
  +
   echo First test the StockQuoteService.jws file
   java samples.stock.GetQuote -uuser1 -wpass1 XXX -s/axis/StockQuoteService.jws
   
   echo Deploy everything first
  -java org.apache.axis.client.AdminClient deploy.xml
  +java org.apache.axis.client.http.HTTPAdminClient deploy.xml
   
   echo These next 2 should work...
   java samples.stock.GetQuote -uuser1 -wpass1 XXX
  @@ -19,4 +21,4 @@
   java samples.stock.GetQuote -d -uuser1 -wpass1 XXX
   
   echo Now undeploy everything
  -java org.apache.axis.client.AdminClient undeploy.xml
  +java org.apache.axis.client.http.HTTPAdminClient undeploy.xml
  
  
  
  1.6       +2 -2      xml-axis/java/samples/stock/testit.sh
  
  Index: testit.sh
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/stock/testit.sh,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- testit.sh	2001/04/22 19:29:12	1.5
  +++ testit.sh	2001/05/31 09:22:59	1.6
  @@ -2,7 +2,7 @@
   # this assumes webserver is running on port 8080
   
   echo "Deploy everything first"
  -java org.apache.axis.client.AdminClient deploy.xml
  +java org.apache.axis.client.http.HTTPAdminClient deploy.xml
   
   echo "These next 2 should work..."
   java samples.stock.GetQuote -uuser1 -wpass1 XXX
  @@ -17,4 +17,4 @@
   java samples.stock.GetQuote -d -uuser1 -wpass1 XXX
   
   # Now undeploy everything
  -java org.apache.axis.client.AdminClient undeploy.xml
  +java org.apache.axis.client.http.HTTPAdminClient undeploy.xml
  
  
  
  1.2       +10 -7     xml-axis/java/samples/transport/FileTest.java
  
  Index: FileTest.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/transport/FileTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FileTest.java	2001/05/30 14:20:42	1.1
  +++ FileTest.java	2001/05/31 09:23:10	1.2
  @@ -3,7 +3,9 @@
   import java.lang.Thread ;
   
   import org.apache.axis.AxisFault ;
  -import org.apache.axis.client.* ;
  +import org.apache.axis.client.AxisClient ;
  +import org.apache.axis.client.ServiceClient ;
  +import org.apache.axis.client.http.HTTPClient ;
   import org.apache.axis.utils.Debug ;
   import org.apache.axis.utils.Options ;
   import org.apache.axis.encoding.* ;
  @@ -33,27 +35,28 @@
         }
       
         String   symbol = args[0] ;
  -      HTTPCall call   = new HTTPCall( opts.getURL(),
  -                                      "urn:xmltoday-delayed-quotes" );
  +      ServiceClient call   = new ServiceClient(new HTTPClient());
  +      call.set(HTTPClient.URL, opts.getURL());
  +      call.set(HTTPClient.ACTION, "urn:xmltoday-delayed-quotes");
         ServiceDescription sd = new ServiceDescription("stockQuotes", true);
         sd.addOutputParam("return", SOAPTypeMappingRegistry.XSD_FLOAT);
         call.setServiceDescription(sd);
       
         if ( opts.isFlagSet('t') > 0 ) call.doLocal = true ;
       
  -      call.setUserID( opts.getUser() );
  -      call.setPassword( opts.getPassword() );
  +      call.set(AxisClient.USER, opts.getUser() );
  +      call.set(AxisClient.PASSWORD, opts.getPassword() );
         call.setTransportInput( "FileSender" );
       
         Float res = new Float(0.0F);
  -      res = (Float) call.invoke( "http://schemas.xmlsoap.org/soap/envelope/", 
  +      res = (Float) call.invoke( "http://schemas.xmlsoap.org/soap/envelope/",
                                    "getQuote",
                                    new Object[] {symbol} );
       
         System.out.println( symbol + ": " + res );
   
         // Once more just for fun...
  -      res = (Float) call.invoke( "http://schemas.xmlsoap.org/soap/envelope/", 
  +      res = (Float) call.invoke( "http://schemas.xmlsoap.org/soap/envelope/",
                                    "getQuote",
                                    new Object[] {symbol} );
       
  
  
  
  1.24      +7 -1      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.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- MessageContext.java	2001/05/30 20:00:03	1.23
  +++ MessageContext.java	2001/05/31 09:23:16	1.24
  @@ -215,7 +215,7 @@
         HandlerRegistry sr = (HandlerRegistry)
                               getProperty(Constants.SERVICE_REGISTRY);
         if (sr == null)
  -	    return;
  +        return;
         
         Handler service = sr.find(tServ);
         if (service == null)
  @@ -273,6 +273,12 @@
   
       /** The protocol specific handler (ie. SOAP) */
       public static String PROTOCOL_HANDLER    = "procotol.handler";
  +    
  +    /** Has a quit been requested? Hackish... but useful... -- RobJ */
  +    public static String QUIT_REQUESTED = "quit.requested";
  +  
  +  /** Property name for session context */
  +  public static String SESSION_CONTEXT = "session.context";
   
       /** A String with the user's ID (if available)
        */
  
  
  
  1.7       +112 -91   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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AxisClient.java	2001/05/30 14:18:18	1.6
  +++ AxisClient.java	2001/05/31 09:23:24	1.7
  @@ -62,15 +62,26 @@
   import org.apache.axis.registries.* ;
   
   /**
  + * Provides the equivalent of an "Axis engine" on the client side.
  + * Subclasses hardcode initialization & setup logic for particular
  + * client-side transports.
    *
  + * @author Rob Jellinghaus (robj@unrealities.com)
    * @author Doug Davis (dug@us.ibm.com)
    * @author Glen Daniels (gdaniels@allaire.com)
    */
  -public class AxisClient extends BasicHandler
  +public abstract class AxisClient extends BasicHandler
   {
       public AxisClient() {}
  -
  +    
       /**
  +     * Property names for user & password.
  +     * Soon to be moved elsewhere.
  +     */
  +    public static String USER = "user";
  +    public static String PASSWORD = "password";
  +    
  +    /**
        * Allows the Listener to specify which handler/service registry
        * implementation they want to use.
        */
  @@ -83,7 +94,7 @@
           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.
  @@ -96,27 +107,37 @@
           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);
  +        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" );
       }
  -
  +    
       /**
  +     * Set up the message context as appropriate for this transport.
  +     * @param context the context to set up (with transport chain info, etc.)
  +     * @param message the client service instance
  +     * @throws AxisFault if service cannot be found
  +     */
  +    public abstract void setupMessageContext
  +        (MessageContext context, ServiceClient message, boolean doLocal)
  +        throws AxisFault;
  +    
  +    /**
        * Main routine of the AXIS server.  In short we locate the appropriate
        * handler for the desired service and invoke() it.
        */
       public void invoke(MessageContext msgContext) throws AxisFault {
           Debug.Print( 1, "Enter: AxisClient::invoke" );
  -
  +        
           String  hName = null ;
           Handler h     = null ;
  -
  +        
           /* Do some prep-work.  Get the registries and put them in the */
           /* msgContext so they can be used by later handlers.          */
           /**************************************************************/
  @@ -124,92 +145,92 @@
               (HandlerRegistry) getOption(Constants.HANDLER_REGISTRY);
           HandlerRegistry sr = 
               (HandlerRegistry) getOption(Constants.SERVICE_REGISTRY);
  -
  +        
           if ( hr != null )
  -          msgContext.setProperty(Constants.HANDLER_REGISTRY, hr);
  +            msgContext.setProperty(Constants.HANDLER_REGISTRY, hr);
           if ( sr != null )
  -          msgContext.setProperty(Constants.SERVICE_REGISTRY, sr);
  -
  +            msgContext.setProperty(Constants.SERVICE_REGISTRY, sr);
  +        
           try {
  -          hName = msgContext.getStrProp( MessageContext.ENGINE_HANDLER );
  -          Debug.Print( 2, "EngineHandler: " + hName );
  -
  -          if ( hName != null ) {
  -            h = hr.find( hName );
  -            if ( h != null ) 
  -              h.invoke(msgContext);
  -            else
  -              throw new AxisFault( "Client.error",
  -                                   "Can't locate handler: " + 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??
  -  
  -            SimpleTargetedChain service = null ;
  -  
  -            /* Process the Service Specific Request Chain */
  -            /**********************************************/
  -            hName =  msgContext.getTargetService();
  -            if ( hName != null && (h = sr.find( hName )) != null ) {
  -              if ( h instanceof SimpleTargetedChain ) {
  -                service = (SimpleTargetedChain) h ;
  -                h = service.getInputChain();
  -              }
  -              if ( h != null ) h.invoke( msgContext );
  +            hName = msgContext.getStrProp( MessageContext.ENGINE_HANDLER );
  +            Debug.Print( 2, "EngineHandler: " + hName );
  +            
  +            if ( hName != null ) {
  +                h = hr.find( hName );
  +                if ( h != null )
  +                    h.invoke(msgContext);
  +                else
  +                    throw new AxisFault( "Client.error",
  +                                        "Can't locate handler: " + hName,
  +                                        null, null );
               }
  -  
  -            /* Process the Global Input Chain */
  -            /**********************************/
  -            hName = Constants.GLOBAL_INPUT ;
  -            if ( hName != null  && (h = hr.find( hName )) != null )
  -                h.invoke(msgContext);
  -  
  -            /* Process the Transport Specific Input Chain */
  -            /**********************************************/
  -            hName = msgContext.getStrProp(MessageContext.TRANS_INPUT);
  -            if ( hName != null && (h = hr.find( hName )) != null )
  -              h.invoke(msgContext);
  -  
  -            /* Note: at the end of the transport specific input chain should */
  -            /* have been a handler that called the server.                   */
  -            /*****************************************************************/
  -    
  -            /* Process the Transport Specific Output Chain */
  -            /***********************************************/
  -            hName = msgContext.getStrProp(MessageContext.TRANS_OUTPUT);
  -            if ( hName != null  && (h = hr.find( hName )) != null )
  -              h.invoke(msgContext);
  -  
  -            /* Process the Global Output Chain */
  -            /***********************************/
  -            hName = Constants.GLOBAL_OUTPUT ;
  -            if ( hName != null && (h = hr.find( hName )) != null )
  -              h.invoke(msgContext);
  -  
  -            if ( service != null ) {
  -              h = service.getOutputChain();
  -              if ( h != null )
  -                h.invoke(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:         */
  +                /*                                                            */
  +                /*   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??
  +                
  +                SimpleTargetedChain service = null ;
  +                
  +                /* Process the Service Specific Request Chain */
  +                /**********************************************/
  +                hName =  msgContext.getTargetService();
  +                if ( hName != null && (h = sr.find( hName )) != null ) {
  +                    if ( h instanceof SimpleTargetedChain ) {
  +                        service = (SimpleTargetedChain) h ;
  +                        h = service.getInputChain();
  +                    }
  +                    if ( h != null ) h.invoke( msgContext );
  +                }
  +                
  +                /* Process the Global Input Chain */
  +                /**********************************/
  +                hName = Constants.GLOBAL_INPUT ;
  +                if ( hName != null  && (h = hr.find( hName )) != null )
  +                    h.invoke(msgContext);
  +                
  +                /* Process the Transport Specific Input Chain */
  +                /**********************************************/
  +                hName = msgContext.getStrProp(MessageContext.TRANS_INPUT);
  +                if ( hName != null && (h = hr.find( hName )) != null )
  +                    h.invoke(msgContext);
  +                
  +                /* Note: at the end of the transport specific input chain should */
  +                /* have been a handler that called the server.                   */
  +                /*****************************************************************/
  +                
  +                /* Process the Transport Specific Output Chain */
  +                /***********************************************/
  +                hName = msgContext.getStrProp(MessageContext.TRANS_OUTPUT);
  +                if ( hName != null  && (h = hr.find( hName )) != null )
  +                    h.invoke(msgContext);
  +                
  +                /* Process the Global Output Chain */
  +                /***********************************/
  +                hName = Constants.GLOBAL_OUTPUT ;
  +                if ( hName != null && (h = hr.find( hName )) != null )
  +                    h.invoke(msgContext);
  +                
  +                if ( service != null ) {
  +                    h = service.getOutputChain();
  +                    if ( h != null )
  +                        h.invoke(msgContext);
  +                }
  +                
  +                // Do SOAP Semantics checks here - this needs to be a call to
  +                // a pluggable object/handler/something
               }
  -  
  -            // Do SOAP Semantics checks here - this needs to be a call to
  -            // a pluggable object/handler/something
  -          }
           }
           catch( Exception e ) {
               // Should we even bother catching it ?
  @@ -219,7 +240,7 @@
           }
           Debug.Print( 1, "Exit: AxisClient::invoke" );
       };
  -
  +    
       public void undo(MessageContext msgContext) {
           Debug.Print( 1, "Enter: AxisClient::undo" );
           Debug.Print( 1, "Exit: AxisClient::undo" );
  
  
  
  1.3       +37 -18    xml-axis/java/src/org/apache/axis/deployment/v2dd/V2DDDeployableItem.java
  
  Index: V2DDDeployableItem.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/v2dd/V2DDDeployableItem.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- V2DDDeployableItem.java	2001/05/06 04:09:43	1.2
  +++ V2DDDeployableItem.java	2001/05/31 09:23:37	1.3
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 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 
  + *    software without prior written permission. For written
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -57,7 +57,8 @@
   import java.io.Serializable;
   import org.apache.axis.Handler;
   import org.apache.axis.SimpleTargetedChain;
  -import org.apache.axis.handlers.providers.*;
  +import org.apache.axis.providers.*;
  +import org.apache.axis.providers.java.*;
   import org.apache.axis.deployment.v2dd.providers.*;
   import org.apache.axis.deployment.DeployableItem;
   import org.apache.axis.deployment.DeploymentRegistry;
  @@ -66,20 +67,21 @@
   /**
    * This is the class that actually bridges the gap between
    * SOAP 2.x and Axis.  An instance of this class is stored
  - * within the registry and a new handler is created that 
  + * within the registry and a new handler is created that
    * represents the SOAP 2.x service when the newInstance
    * method is called.
    */
  -public class V2DDDeployableItem implements DeployableItem, Serializable { 
  +public class V2DDDeployableItem implements DeployableItem, Serializable {
   
       V2DDService service;
       QName qname;
       
  -    public V2DDDeployableItem(V2DDService service) {        
  +    public V2DDDeployableItem(V2DDService service) {
           this.service = service;
       }
       
  -    public QName getQName() {
        if (qname == null) {
  +    public QName getQName() {
  +        if (qname == null) {
               qname = new QName(null, service.getID());
           }
           return qname;
  @@ -87,19 +89,36 @@
   
       public Handler newInstance(DeploymentRegistry registry) {
           
  -        // we would create an instance of the SOAP v2.x
        // compatible handler here using the service
        // definition to configure the instance
  -        
        try {
  -            SimpleTargetedChain stc = new SimpleTargetedChain();
            
            V2DDProvider prov = service.getProvider();
  -            String[] methods = prov.getMethods();

            BasicProvider provider = null;
            
  -            if (prov instanceof V2DDComProvider) provider = new ComProvider();
            if (prov instanceof V2DDScriptProvider) provider = new BSFProvider();
            if (provider == null) provider = new JavaProvider();
  -               
            provider.setOptions(prov.getOptionsTable());
  +        // we would create an instance of the SOAP v2.x
  +        // compatible handler here using the service
  +        // definition to configure the instance
  +        
  +        try {
  +            SimpleTargetedChain stc = new SimpleTargetedChain();
  +            
  +            V2DDProvider prov = service.getProvider();
  +            String[] methods = prov.getMethods();
  +
  +            BasicProvider provider = null;
  +            
  +            if (prov instanceof V2DDComProvider) provider = new ComProvider();
  +            if (prov instanceof V2DDScriptProvider) provider = new BSFProvider();
  +            
  +            // ROBJ 911 -- this will need to be fixed now that JavaProvider really
  +            // exists!  But I am not sure of the intended semantics here.  Nor am
  +            // I sure whether any test code exists for this...?!?!
  +            if (provider == null) provider = new RPCProvider();
  +               
  +            provider.setOptions(prov.getOptionsTable());
               prov.newInstance(provider);
               
               for (int n = 0; n < methods.length; n++) {
                   provider.addOperation(methods[n],
  -                                      new QName(V2DDConstants.V2DD_NS, 
  -                                                methods[n]));
            }
  -            
            return provider;
  +                                      new QName(V2DDConstants.V2DD_NS,
  +                                                methods[n]));
  +            }
  +            
  +            return provider;
           } catch (Exception e) {
               return null;
           }
  
  
  
  1.3       +9 -9      xml-axis/java/src/org/apache/axis/deployment/v2dd/V2DDProvider.java
  
  Index: V2DDProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/v2dd/V2DDProvider.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- V2DDProvider.java	2001/05/06 04:09:43	1.2
  +++ V2DDProvider.java	2001/05/31 09:23:40	1.3
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 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 
  + *    software without prior written permission. For written
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -58,15 +58,15 @@
   import java.util.Hashtable;
   import org.w3c.dom.Element;
   import org.w3c.dom.NodeList;
  -import org.apache.axis.handlers.providers.BasicProvider;
  +import org.apache.axis.providers.BasicProvider;
   import org.apache.axis.utils.LockableHashtable;
   import org.apache.axis.deployment.v2dd.providers.*;
   
  -public class V2DDProvider extends V2DDElement { 
  +public class V2DDProvider extends V2DDElement {
   
       private static Hashtable providers;
       static {
  -        providers = new Hashtable();   
  +        providers = new Hashtable();
           providers.put("java", V2DDJavaProvider.class);
           providers.put("script", V2DDScriptProvider.class);
           providers.put("com", V2DDComProvider.class);
  @@ -83,7 +83,7 @@
           } catch (Exception ex) {
               return null;
           }
  -    }    
  +    }
       
       LockableHashtable options;
       
  @@ -132,7 +132,7 @@
               for (int n = 0; n < opts.length; n++) {
                   options.put(opts[n].getKey(), opts[n].getValue(), true);
               }
  -        } 
  +        }
           return options;
       }
       
  
  
  
  1.3       +7 -7      xml-axis/java/src/org/apache/axis/deployment/v2dd/providers/V2DDComProvider.java
  
  Index: V2DDComProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/v2dd/providers/V2DDComProvider.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- V2DDComProvider.java	2001/05/06 04:09:43	1.2
  +++ V2DDComProvider.java	2001/05/31 09:23:44	1.3
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 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 
  + *    software without prior written permission. For written
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -54,15 +54,15 @@
    */
   package org.apache.axis.deployment.v2dd.providers;
   
  -import org.apache.axis.handlers.providers.BasicProvider;
  +import org.apache.axis.providers.BasicProvider;
   import org.apache.axis.deployment.v2dd.V2DDProvider;
   import org.apache.axis.deployment.v2dd.V2DDOption;
   import org.apache.axis.deployment.v2dd.V2DDConstants;
  -import org.apache.axis.handlers.providers.ComProvider;
  +import org.apache.axis.providers.ComProvider;
   import org.w3c.dom.Element;
   import org.w3c.dom.NodeList;
   
  -public class V2DDComProvider extends V2DDProvider { 
  +public class V2DDComProvider extends V2DDProvider {
   
       public V2DDComProvider(Element e) {
           super(e);
  
  
  
  1.3       +8 -8      xml-axis/java/src/org/apache/axis/deployment/v2dd/providers/V2DDJavaProvider.java
  
  Index: V2DDJavaProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/v2dd/providers/V2DDJavaProvider.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- V2DDJavaProvider.java	2001/05/06 04:09:43	1.2
  +++ V2DDJavaProvider.java	2001/05/31 09:23:46	1.3
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 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 
  + *    software without prior written permission. For written
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -54,14 +54,14 @@
    */
   package org.apache.axis.deployment.v2dd.providers;
   
  -import org.apache.axis.handlers.providers.BasicProvider;
  +import org.apache.axis.providers.BasicProvider;
   import org.apache.axis.deployment.v2dd.V2DDProvider;
   import org.apache.axis.deployment.v2dd.V2DDConstants;
  -import org.apache.axis.handlers.providers.JavaProvider;
  +import org.apache.axis.providers.java.JavaProvider;
   import org.w3c.dom.Element;
   import org.w3c.dom.NodeList;
   
  -public class V2DDJavaProvider extends V2DDProvider { 
  +public class V2DDJavaProvider extends V2DDProvider {
   
       public V2DDJavaProvider(Element e) {
           super(e);
  @@ -71,7 +71,7 @@
           NodeList nl = getElement().getElementsByTagNameNS(V2DDConstants.V2DD_NS, "java");
           Element java = (Element)nl.item(0);
           provider.addOption(JavaProvider.OPTION_CLASSNAME, java.getAttribute("class"));
  -        provider.addOption(JavaProvider.OPTION_IS_STATIC, 
  +        provider.addOption(JavaProvider.OPTION_IS_STATIC,
                              new Boolean(java.getAttribute("isStatic")));
       }
       
  
  
  
  1.3       +7 -7      xml-axis/java/src/org/apache/axis/deployment/v2dd/providers/V2DDScriptProvider.java
  
  Index: V2DDScriptProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/v2dd/providers/V2DDScriptProvider.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- V2DDScriptProvider.java	2001/05/06 04:09:43	1.2
  +++ V2DDScriptProvider.java	2001/05/31 09:23:47	1.3
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 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 
  + *    software without prior written permission. For written
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -54,15 +54,15 @@
    */
   package org.apache.axis.deployment.v2dd.providers;
   
  -import org.apache.axis.handlers.providers.BasicProvider;
  +import org.apache.axis.providers.BasicProvider;
   import org.apache.axis.deployment.v2dd.V2DDProvider;
   import org.apache.axis.deployment.v2dd.V2DDConstants;
  -import org.apache.axis.handlers.providers.BSFProvider;
  +import org.apache.axis.providers.BSFProvider;
   import org.apache.axis.utils.XMLUtils;
   import org.w3c.dom.Element;
   import org.w3c.dom.NodeList;
   
  -public class V2DDScriptProvider extends V2DDProvider { 
  +public class V2DDScriptProvider extends V2DDProvider {
   
       public V2DDScriptProvider(Element e) {
           super(e);
  
  
  
  1.3       +8 -8      xml-axis/java/src/org/apache/axis/deployment/wsdd/providers/WSDDBsfProvider.java
  
  Index: WSDDBsfProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/providers/WSDDBsfProvider.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WSDDBsfProvider.java	2001/05/06 04:09:44	1.2
  +++ WSDDBsfProvider.java	2001/05/31 09:23:54	1.3
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 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 
  + *    software without prior written permission. For written
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -59,14 +59,14 @@
   import org.apache.axis.deployment.wsdd.WSDDException;
   import org.apache.axis.deployment.wsdd.WSDDConstants;
   import org.apache.axis.deployment.DeploymentRegistry;
  -import org.apache.axis.handlers.providers.BSFProvider;
  -import org.apache.axis.handlers.providers.BasicProvider;
  +import org.apache.axis.providers.BSFProvider;
  +import org.apache.axis.providers.BasicProvider;
   import org.apache.axis.utils.QName;
   import org.apache.axis.utils.XMLUtils;
  -import org.w3c.dom.Element; 
  +import org.w3c.dom.Element;
   import org.w3c.dom.NodeList;
   
  -public class WSDDBsfProvider extends WSDDProvider { 
  +public class WSDDBsfProvider extends WSDDProvider {
       
       public WSDDBsfProvider(Element e) throws WSDDException { super(e); }
       
  
  
  
  1.3       +8 -8      xml-axis/java/src/org/apache/axis/deployment/wsdd/providers/WSDDComProvider.java
  
  Index: WSDDComProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/providers/WSDDComProvider.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WSDDComProvider.java	2001/05/06 04:09:44	1.2
  +++ WSDDComProvider.java	2001/05/31 09:23:56	1.3
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 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 
  + *    software without prior written permission. For written
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -59,15 +59,15 @@
   import org.apache.axis.deployment.wsdd.WSDDException;
   import org.apache.axis.deployment.wsdd.WSDDConstants;
   import org.apache.axis.deployment.DeploymentRegistry;
  -import org.apache.axis.handlers.providers.ComProvider;
  -import org.apache.axis.handlers.providers.BasicProvider;
  +import org.apache.axis.providers.ComProvider;
  +import org.apache.axis.providers.BasicProvider;
   import org.apache.axis.utils.QName;
   import org.w3c.dom.Element;
   import org.w3c.dom.NodeList;
   
  -public class WSDDComProvider extends WSDDProvider { 
  +public class WSDDComProvider extends WSDDProvider {
       
  -    public WSDDComProvider(Element e) throws WSDDException { super(e); }    
  +    public WSDDComProvider(Element e) throws WSDDException { super(e); }
     
       public Handler newProviderInstance(DeploymentRegistry registry) throws Exception {
           String type;
  
  
  
  1.3       +7 -7      xml-axis/java/src/org/apache/axis/deployment/wsdd/providers/WSDDJavaProvider.java
  
  Index: WSDDJavaProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/providers/WSDDJavaProvider.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WSDDJavaProvider.java	2001/05/06 04:09:44	1.2
  +++ WSDDJavaProvider.java	2001/05/31 09:23:57	1.3
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 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 
  + *    software without prior written permission. For written
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -59,13 +59,13 @@
   import org.apache.axis.deployment.wsdd.WSDDException;
   import org.apache.axis.deployment.DeploymentRegistry;
   import org.apache.axis.deployment.wsdd.WSDDConstants;
  -import org.apache.axis.handlers.providers.JavaProvider;
  -import org.apache.axis.handlers.providers.BasicProvider;
  +import org.apache.axis.providers.java.JavaProvider;
  +import org.apache.axis.providers.BasicProvider;
   import org.apache.axis.utils.QName;
   import org.w3c.dom.Element;
   import org.w3c.dom.NodeList;
   
  -public class WSDDJavaProvider extends WSDDProvider { 
  +public class WSDDJavaProvider extends WSDDProvider {
       
       public WSDDJavaProvider(Element e) throws WSDDException { super(e); }
       
  
  
  
  1.9       +5 -3      xml-axis/java/src/org/apache/axis/handlers/JWSProcessor.java
  
  Index: JWSProcessor.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/JWSProcessor.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- JWSProcessor.java	2001/05/10 22:19:29	1.8
  +++ JWSProcessor.java	2001/05/31 09:24:10	1.9
  @@ -60,6 +60,8 @@
   import org.apache.axis.utils.Debug ;
   import org.apache.axis.utils.XMLUtils ;
   import org.apache.axis.utils.AxisClassLoader ;
  +import org.apache.axis.providers.java.RPCProvider;
  +
   import sun.tools.javac.Main;
   
   import org.w3c.dom.* ;
  @@ -131,7 +133,7 @@
           String            outdir   = f1.getParent();
           String[]          args     = null ;
           
  -        args = new String[] { "-d", outdir, 
  +        args = new String[] { "-d", outdir,
                                 "-classpath",
                                   System.getProperty("java.class.path" ),
                                 jFile };
  @@ -174,10 +176,10 @@
           cl.registerClass( clsName, cFile );
         msgContext.setClassLoader( cl );
   
  -      /* Create a new RPCDispatchHandler - this will be the "service"   */
  +      /* Create a new RPCProvider - this will be the "service"   */
         /* that we invoke.                                                */
         /******************************************************************/
  -      Handler rpc = new RPCDispatchHandler();
  +      Handler rpc = new RPCProvider();
         msgContext.setServiceHandler( rpc );
   
         rpc.addOption( "className", clsName );
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/handlers/tcp/TCPActionHandler.java
  
  Index: TCPActionHandler.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.handlers.tcp;
  
  import java.net.URL;
  import java.util.*;
  
  import org.apache.axis.*;
  import org.apache.axis.handlers.BasicHandler;
  import org.apache.axis.message.*;
  import org.apache.axis.registries.*;
  import org.apache.axis.utils.*;
  
  /** A <code>TCPActionHandler</code> sets the context's TargetService
   * property from the first method name in the first RPCElement of the
   * Body.
   *
   * This is not at all the right thing, really, but it's not clear to me
   * how TargetService is *supposed* to be set in transports which have no
   * SOAPAction!
   *
   * Once Sam's changes go in, this probably goes away altogether.
   *
   * @author Rob Jellinghaus (robj@unrealities.com)
   * @author Glen Daniels (gdaniels@allaire.com)
   * @author Doug Davis (dug@us.ibm.com)
   */
  public class TCPActionHandler extends BasicHandler
  {
    public void invoke(MessageContext msgContext) throws AxisFault
    {
      Debug.Print( 1, "Enter: TCPActionHandler::invoke" );
      
      /** If there's already a targetService (ie. JWSProcessor) then
       *  just return.
       */
      if ( msgContext.getTargetService() == null ) {
        
        String targetServiceName = null;
  
        // There *IS* no URL for TCP transport!
        // (If there were, we might have the service name on the end of it....)
        /*
        String urlStr = msgContext.getStrProp(msgContext.TRANS_URL);
        try {
          URL url = new URL(urlStr);
          targetServiceName = url.getPath().substring(1);
        } catch (Exception ex) {
          throw new AxisFault("TCPActionHandler.invoke", "Can't parse service part of url "+urlStr, null, null);
        }
         */
        
        // This is icky (the full extraction of the SOAPEnvelope kills
        // performance), but doing it properly would require patching
        // RPCDispatchHandler to deal with a null TargetService at
        // RPCDispatch time.
        // For now, I'm trying to implement the TCP transport without
        // patching *any* existing files.  -- RobJ
        
        SOAPEnvelope    env    = (SOAPEnvelope) msgContext.getRequestMessage().getAs("SOAPEnvelope");
  
        Vector          bodies = env.getBodyElements();
        for ( int bNum = 0 ; bNum < bodies.size() ; bNum++ ) {
          if (!(bodies.get(bNum) instanceof RPCElement))
              continue;
          RPCElement   body  = (RPCElement) bodies.get( bNum );
          String       mName = body.getMethodName();
          
          // do we have a namespace URI?
          // if so, use it
          if (body.getNamespaceURI() != null) {
            targetServiceName = body.getNamespaceURI();
          } else {
            // Do linear search over the HandlerRegistry, looking for the first
            // service with mName as its method name.  This is definitely inefficient
            // 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);
            String[] list = hr.list();
            Handler handler = null;
            for (int i = 0; i < list.length; i++) {
              handler = hr.find(list[i]);
              // why would handler ever be null here?!?!
              if (handler != null) {
                String  methodName = (String) handler.getOption( "methodName" );
                if (methodName != null && methodName.equals(mName)) {
                  // we found it
                  targetServiceName = list[i];
                  break;
                }
              }
            }
          }
          
          if (targetServiceName == null) {
            // couldn't find service with that method name, fault
            throw new AxisFault("Server.NoServiceForMethod", "Could not find service with method name "+mName, null, null);
          }
          
          Debug.Print( 2, "  First method name: " + mName );
          
        }
        
        msgContext.setTargetService( targetServiceName );
      }
      
      // Just for kicks, try getting the message back as String, to cure
      // downstream handlers... don't really understand this bit
      // YOW, THIS WORKS!
      // ROBJ 911 remove this once I verify that getAs("SOAPEnvelope") twice in a row is a
      // Bad Thing.  (and once I figure out what else I should be doing!)
      String test = (String)msgContext.getRequestMessage().getAs("String");
      
      Debug.Print( 1, "Exit: TCPActionHandler::invoke" );
    }
    
    public void undo(MessageContext msgContext)
    {
      Debug.Print( 1, "Enter: HTTPActionHandler::undo" );
      Debug.Print( 1, "Exit: HTTPActionHandler::undo" );
    }
  }
  
  
  
  1.9       +11 -9     xml-axis/java/src/org/apache/axis/registries/DefaultHandlerRegistry.java
  
  Index: DefaultHandlerRegistry.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/registries/DefaultHandlerRegistry.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DefaultHandlerRegistry.java	2001/05/05 22:17:00	1.8
  +++ DefaultHandlerRegistry.java	2001/05/31 09:24:40	1.9
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 2001 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
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *  notice, this list of conditions and the following disclaimer. 
  + *  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
  @@ -18,7 +18,7 @@
    *  distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *  if any, must include the following acknowledgment:  
  + *  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,
  @@ -26,7 +26,7 @@
    *
    * 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 
  + *  software without prior written permission. For written
    *  permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -66,10 +66,12 @@
   import org.apache.axis.handlers.http.*;
   import org.apache.axis.suppliers.* ;
   import org.apache.axis.registries.* ;
  +import org.apache.axis.providers.java.RPCProvider;
  +import org.apache.axis.providers.java.MsgProvider;
   
   import org.apache.axis.transport.http.* ;
   
  -/** 
  +/**
    *
    * @author Doug Davis (dug@us.ibm.com)
    */
  @@ -89,9 +91,9 @@
       dontSave = b ;
     }
     
  -  protected void load() { 
  +  protected void load() {
       super.load();
  -    if ( suppliers != null && suppliers.size() != 0 ) 
  +    if ( suppliers != null && suppliers.size() != 0 )
         return ;
   
       /* If we got here then there was no registry on the filesystem */
  @@ -114,8 +116,8 @@
       if ( onServer ) {
         this.add( "debug"        , new DebugHandler() );
         //this.add( "SOAPServer"   , new SOAPServerHandler() );
  -      this.add( "MsgDispatcher", new MsgDispatchHandler() );
  -      this.add( "RPCDispatcher", new RPCDispatchHandler() );
  +      this.add( "MsgDispatcher", new MsgProvider() );
  +      this.add( "RPCDispatcher", new RPCProvider() );
         this.add( "HTTPSender"   , new HTTPDispatchHandler() );
         this.add( "HTTPAction"   , new HTTPActionHandler() );
         this.add( "HTTPAuth"     , new HTTPAuthHandler() );
  
  
  
  1.7       +96 -41    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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SimpleAxisServer.java	2001/05/26 19:27:07	1.6
  +++ SimpleAxisServer.java	2001/05/31 09:24:45	1.7
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 2000 The Apache Software Foundation.  All rights 
  + * Copyright (c) 2000 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 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 
  + *    software without prior written permission. For written
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -90,17 +90,24 @@
       private static byte ISE[]    = "500 Internal Server Error".getBytes();
   
       // Standard MIME headers
  -    private static byte MIME_STUFF[] = 
  +    private static byte MIME_STUFF[] =
           ( "\nContent-Type: text/xml\n" +
             "Content-Length: ").getBytes();
   
       // Mime/Content separator
       private static byte SEPARATOR[] = "\n\n".getBytes();
  +    
  +    // Tiddly little response
  +    private static byte cannedResponse[] = "<empty/>".getBytes();
   
       // Axis specific constants
       private static String transportInName = "HTTPAction";
       private static String transportOutName = "HTTP.output";
       private static final String AXIS_ENGINE = "AxisEngine" ;
  +    
  +    // are we stopped?
  +    // latch to true if stop() is called
  +    private boolean stopped = false;
   
       /**
        * The main workhorse method.
  @@ -121,20 +128,21 @@
           msgContext.setProperty(MessageContext.TRANS_OUTPUT, transportOutName);
   
           // Reusuable, buffered, content length controlled, InputStream
  -        NonBlockingBufferedInputStream is = 
  +        NonBlockingBufferedInputStream is =
               new NonBlockingBufferedInputStream();
   
           // SoapAction
           StringBuffer soapAction = new StringBuffer();
  +        StringBuffer httpRequest = new StringBuffer();
   
           // And, just in case it is needed...
           Message faultMsg = new Message(null, "AxisFault");
   
           // Accept and process requests from the socket
  -	while (worker==null || !worker.isInterrupted()) {
  +    while (!stopped) {
               Socket socket = null;
   
  -            // prepare request (do as much as possible while waiting for the 
  +            // prepare request (do as much as possible while waiting for the
               // next connection).  Note the next two statements are commented
               // out.  Uncomment them if you experience any problems with not
               // resetting state between requests:
  @@ -146,9 +154,9 @@
               msgContext.clearProperties();
               msgContext.setProperty(MessageContext.TRANS_INPUT, transportInName);
               msgContext.setProperty(MessageContext.TRANS_OUTPUT, transportOutName);
  -	    try {
  +        try {
                   try {
  -	            socket = serverSocket.accept();
  +                socket = serverSocket.accept();
                   } catch (IOException ioe) {
                       break;
                   }
  @@ -159,14 +167,29 @@
                   try {
                       // read headers
                       is.setInputStream(socket.getInputStream());
  -		    int contentLength = parseHeaders(is, soapAction);
  +                    int contentLength = parseHeaders(is, soapAction, httpRequest);
                       is.setContentLength(contentLength);
   
  +                    // if get, then return simpleton document as response
  +                    if (httpRequest.toString().equals("GET")) {
  +                        OutputStream out = socket.getOutputStream();
  +                        out.write(HTTP);
  +                        out.write(status);
  +                        out.write(MIME_STUFF);
  +                        putInt(out, cannedResponse.length);
  +                        out.write(SEPARATOR);
  +                        out.write(cannedResponse);
  +                        out.flush();
  +                        continue;
  +                    }
  +                        
                       // set up request
  +                    
  +                    
                       String soapActionString = soapAction.toString();
                       requestMsg.setCurrentMessage(is, "InputStream");
                       msgContext.setTargetService(soapActionString);
  -                    msgContext.setProperty(HTTPConstants.MC_HTTP_SOAPACTION, 
  +                    msgContext.setProperty(HTTPConstants.MC_HTTP_SOAPACTION,
                                              soapActionString);
   
                       // invoke the Axis engine
  @@ -174,16 +197,16 @@
   
                   } catch( AxisFault af ) {
                       if ("Server.Unauthorized".equals(af.getFaultCode())) {
  -                        status = ISE; // SC_INTERNAL_SERVER_ERROR 
  +                        status = ISE; // SC_INTERNAL_SERVER_ERROR
                       } else {
  -                        status = UNAUTH; // SC_UNAUTHORIZED 
  +                        status = UNAUTH; // SC_UNAUTHORIZED
                       }
   
                       faultMsg.setCurrentMessage(af, "AxisFault");
                       msgContext.setResponseMessage(faultMsg);
   
                   } catch( Exception e ) {
  -                    status = ISE; // SC_INTERNAL_SERVER_ERROR 
  +                    status = ISE; // SC_INTERNAL_SERVER_ERROR
                       faultMsg.setCurrentMessage(new AxisFault(e), "AxisFault");
                       msgContext.setResponseMessage(faultMsg);
                   }
  @@ -194,27 +217,33 @@
                   byte[] response = (byte[]) responseMsg.getAs("Bytes");
   
                   // Send it on its way...
  -		OutputStream out = socket.getOutputStream();
  -		out.write(HTTP);
  -		out.write(status);
  -		out.write(MIME_STUFF);
  -	        putInt(out, response.length);
  -		out.write(SEPARATOR);
  +        OutputStream out = socket.getOutputStream();
  +        out.write(HTTP);
  +        out.write(status);
  +        out.write(MIME_STUFF);
  +            putInt(out, response.length);
  +        out.write(SEPARATOR);
                   out.write(response);
                   out.flush();
  +            
  +            if (msgContext.getProperty(msgContext.QUIT_REQUESTED) != null) {
  +                // why then, quit!
  +                this.stop();
  +            }
   
  -	    } catch (InterruptedIOException iie) {
  -		break;
  -	    } catch (Exception e) {
  -		e.printStackTrace();
  -	    } finally {
  -		try {
  -		    if (socket!=null) socket.close();
  -		} catch (Exception e) {
  -		}
  -	    }
  -	}
  +        } catch (InterruptedIOException iie) {
  +        break;
  +        } catch (Exception e) {
  +        e.printStackTrace();
  +        } finally {
  +        try {
  +            if (socket!=null) socket.close();
  +        } catch (Exception e) {
  +        }
  +        }
       }
  +        System.out.println("SimpleAxisServer quitting.");
  +    }
   
       // ASCII character mapping to lower case
       private static final byte[] toLower = new byte[256];
  @@ -236,7 +265,13 @@
       // mime header for soap action
       private static final byte actionHeader[] = "soapaction: \"".getBytes();
       private static final int actionLen = actionHeader.length;
  +    
  +    // mime header for GET
  +    private static final byte getHeader[] = "GET".getBytes();
   
  +    // mime header for POST
  +    private static final byte postHeader[] = "POST".getBytes();
  +
       // buffer for IO
       private static final int BUFSIZ = 4096;
       private byte buf[] = new byte[BUFSIZ];
  @@ -248,8 +283,8 @@
        * @param off       starting offset into the byte array
        * @param len       maximum number of bytes to read
        */
  -    private int readLine(InputStream is, byte[] b, int off, int len) 
  -        throws IOException 
  +    private int readLine(InputStream is, byte[] b, int off, int len)
  +        throws IOException
       {
           int count = 0, c;
   
  @@ -266,17 +301,39 @@
        * SOAPAction.
        * @param is         InputStream to read from
        * @param soapAction StringBuffer to return the soapAction into
  +     * @param httpRequest StringBuffer for GET / POST
        * @return Content-Length
        */
  -    private int parseHeaders(InputStream is, StringBuffer soapAction)
  -      throws IOException 
  +    private int parseHeaders(InputStream is, StringBuffer soapAction, StringBuffer httpRequest)
  +      throws IOException
       {
           int n;
           int len = 0;
  +        
  +        // parse first line as GET or POST
  +        n=this.readLine(is, buf, 0, buf.length);
  +        if (n < 0) {
  +            // nothing!
  +            throw new IOException("Unexpected end of stream");
  +        }
  +        
  +        // which does it begin with?
  +        httpRequest.delete(0, httpRequest.length());
  +        if (buf[0] == getHeader[0]) {
  +            httpRequest.append("GET");
  +            // return immediately, don't look for more headers
  +            return 0;
  +        } else if (buf[0] == postHeader[0]) {
  +            httpRequest.append("POST");
  +        } else {
  +            throw new IOException("Cannot handle non-GET, non-POST request");
  +        }
  +        
           while ((n=readLine(is,buf,0,buf.length)) > 0) {
           
               int lenMatch = 0;
               int actionMatch = 0;
  +            int getMatch = 0;
               for (int i=0; i<n; i++) {
                   byte c = toLower[buf[i]];
   
  @@ -379,10 +436,10 @@
       }
   
       /**
  -     * Start this server as a daemon.
  +     * Start this server as a NON-daemon.
        */
       public void start() throws Exception {
  -        start(true);
  +        start(false);
       }
   
       /**
  @@ -391,9 +448,7 @@
        * This will interrupt any pending accept().
        */
       public void stop() throws Exception {
  -        /// Calling Thread.stop() is deprecated. See docs for
  -        ///  better patterns using interrupt()
  -        ////////////
  +        stopped = true;
           if (worker != null) worker.interrupt();
       }
   
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/transport/tcp/AxisListener.java
  
  Index: AxisListener.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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.transport.tcp;
  
  import java.io.*;
  import java.util.*;
  import org.apache.axis.* ;
  import org.apache.axis.server.* ;
  import org.apache.axis.utils.* ;
  import org.apache.axis.registries.HandlerRegistry;
  import org.apache.axis.handlers.tcp.TCPActionHandler;
  import org.apache.axis.transport.http.NonBlockingBufferedInputStream;
  import org.apache.axis.handlers.soap.SOAPService;
  
  import java.net.*;
  
  /**
   * Listen for incoming socket connections on the specified socket.  Take
   * incoming messages and dispatch them.
   *
   * @author Rob Jellinghaus (robj@unrealities.com)
   * @author Doug Davis (dug@us.ibm.com)
   */
  public class AxisListener implements Runnable {
      // These have default values.
      private String transportInName = "TCP.input";
      private String transportOutName = "TCP.output";
      
      private static final String AXIS_ENGINE = "AxisEngine" ;
      
      private int port;
      private ServerSocket srvSocket;
      
      private Handler engine = null ;
      
      // becomes true when we want to quit
      private boolean done = false;
      
      public static void main (String args[]) {
          new AxisListener(args).run();
      }
      
      public AxisListener (String[] args) {
          // look for -p, -d arguments
          try {
              Options options = new Options(args);
              port = new URL(options.getURL()).getPort();
              String tmp;
              if ((tmp = options.isValueSet('d')) != null) {
                  Debug.setDebugLevel(Integer.parseInt(tmp));
              }
          } catch (MalformedURLException ex) {
              System.err.println("Hosed URL: "+ex);
              System.exit(1);
          }
          
          try {
              srvSocket = new ServerSocket(port);
          } catch (IOException ex) {
              System.err.println("Can't create server socket on port "+port);
              System.exit(1);
          }
          
          System.out.println("AxisListener is listening on port "+port+".");
      }
      
      public void run () {
          if (srvSocket == null) {
              return;
          }
          
          Socket sock;
          while (!done) {
              try {
                  sock = srvSocket.accept();
                  new Thread(new SocketHandler(sock)).start();
              } catch (IOException ex) {
                  /** stop complaining about this! it seems to happen on quit,
                      and is not worth mentioning.  unless I am confused. -- RobJ
                   System.err.println("Got IOException on srvSocket.accept: "+ex);
                   ex.printStackTrace();
                   */
              }
          }
      }
      
      
      public class SocketHandler implements Runnable {
          private Socket socket;
          public SocketHandler (Socket socket) {
              this.socket = socket;
          }
          public void run () {
              // get the input stream
              if ( engine == null ) {
                  engine = new AxisServer();
                  engine.init();
                  
                  HandlerRegistry hr = (HandlerRegistry)engine.getOption(Constants.HANDLER_REGISTRY);
                  // add the TCPDispatchHandler
                  hr.add("TCPSender", new TCPDispatchHandler());
                  hr.add("TCPAction", new TCPActionHandler());
                  
                  SimpleChain c = new SimpleChain();
                  c.addHandler( hr.find( "TCPAction" ) );
                  hr.add( transportInName, c );
                  
                  // self-register the PseudoStockQuoteService, for testing purposes
                  SOAPService service = new SOAPService();
                  service.setPivotHandler( hr.find( "RPCDispatcher" ) );
                  service.addOption(SOAPService.OPTION_PIVOT, "RPCDispatcher");
                  service.addOption( "className", "org.apache.axis.transport.tcp.PseudoStockQuoteService" );
                  service.addOption( "methodName", "getQuote" );
                  hr.add( "urn:xmltoday-delayed-quotes", service ); // ???
              }
              
              /* Place the Request message in the MessagContext object - notice */
              /* that we just leave it as a 'ServletRequest' object and let the  */
              /* Message processing routine convert it - we don't do it since we */
              /* don't know how it's going to be used - perhaps it might not     */
              /* even need to be parsed.                                         */
              /*******************************************************************/
              MessageContext    msgContext = new MessageContext();
              
              InputStream inp;
              try {
                  inp = socket.getInputStream();
              } catch (IOException ex) {
                  System.err.println("Couldn't get input stream from "+socket);
                  return;
              }
              
              // ROBJ 911
              // the plain ol' inputstream seems to hang in the SAX parse..... WHY?????
              // because there is no content length!
              //Message           msg        = new Message( nbbinp, "InputStream" );
              Message msg = null;
              try {
                  StringBuffer line = new StringBuffer();
                  int b = 0;
                  while ((b = inp.read()) != '\r') {
                      line.append((char)b);
                  }
                  // got to '\r', skip it and '\n'
                  if (inp.read() != '\n') {
                      System.err.println("Length line "+line+" was not terminated with \r\n");
                      return;
                  }
                  
                  // TEST SUPPORT ONLY
                  // If the line says "ping", then respond "\n".
                  // If the line says "quit", then respond "\n" and exit.
                  if (line.toString().equals("ping")) {
                      socket.getOutputStream().write(new String("\n").getBytes());
                      return;
                  } else if (line.toString().equals("quit")) {
                      // peacefully die
                      socket.getOutputStream().write(new String("\n").getBytes());
                      socket.close();
                      srvSocket.close();
                      System.err.println("AxisListener quitting.");
                      System.exit(0);
                  }
                  
                  
                  // OK, assume it is content length
                  int len = Integer.parseInt(line.toString());
                  // read that many bytes into ByteArrayInputStream...
                  
                  // experiment, doesn't work:
                  //        NonBlockingBufferedInputStream nbbinp = new NonBlockingBufferedInputStream();
                  //        nbbinp.setContentLength(len);
                  //        nbbinp.setInputStream(inp);
                  //        msg = new Message(nbbinp, "InputStream");
                  
                  byte[] mBytes = new byte[len];
                  inp.read(mBytes);
                  msg = new Message(new ByteArrayInputStream(mBytes), "InputStream");
              } catch (IOException ex) {
                  System.err.println("Couldn't read from socket input stream: "+ex);
                  return;
              }
              
              
              /* Set the request(incoming) message field in the context */
              /**********************************************************/
              msgContext.setRequestMessage( msg );
              
              /* Set the Transport Specific Input/Output chains IDs */
              /******************************************************/
              msgContext.setProperty(MessageContext.TRANS_INPUT , transportInName );
              msgContext.setProperty(MessageContext.TRANS_OUTPUT, transportOutName );
              
              try {
                  /* Invoke the Axis engine... */
                  /*****************************/
                  engine.invoke( msgContext );
              }
              catch( Exception e ) {
                  if ( !(e instanceof AxisFault) )
                      e = new AxisFault( e );
                  msgContext.setResponseMessage( new Message(e, "AxisFault") );
              }
              
              /* Send it back along the wire...  */
              /***********************************/
              msg = msgContext.getResponseMessage();
              String response = (String) msg.getAs("String");
              if (msg == null) response="No data";
              try {
                  OutputStream buf = new BufferedOutputStream(socket.getOutputStream());
                  // this should probably specify UTF-8, but for now, for Java interop,
                  // use default encoding
                  buf.write(response.getBytes());
                  buf.close();
              } catch (IOException ex) {
                  System.err.println("Can't write response to socket "+port+", response is: "+response);
              }
          }
      }
  }
  
  
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/transport/tcp/PseudoStockQuoteService.java
  
  Index: PseudoStockQuoteService.java
  ===================================================================
  package org.apache.axis.transport.tcp;
  
  public class PseudoStockQuoteService {
    public float getQuote (String symbol) throws Exception {
      // get a real (delayed by 20min) stockquote from
      // http://www.xmltoday.com/examples/stockquote/. The IP addr
      // below came from the host that the above form posts to ..
  
      if ( symbol.equals("XXX") ) return( (float) 55.25 );
      throw new IllegalArgumentException("Symbol not known");
    }
  }
    
    
  
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/transport/tcp/TCPDispatchHandler.java
  
  Index: TCPDispatchHandler.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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.transport.tcp;
  
  import java.io.* ;
  import java.net.* ;
  import java.util.* ;
  import java.lang.reflect.*;
  
  import org.apache.axis.* ;
  import org.apache.axis.utils.* ;
  import org.apache.axis.message.SOAPEnvelope;
  import org.apache.axis.message.SOAPHeader;
  import org.apache.axis.handlers.BasicHandler;
  import org.apache.axis.transport.http.NonBlockingBufferedInputStream;
  import org.apache.axis.encoding.Base64 ;
  
  import org.w3c.dom.* ;
  
  /**
   * This is meant to be used on a SOAP Client to call a SOAP server.
   *
   * @author Doug Davis (dug@us.ibm.com)
   */
  public class TCPDispatchHandler extends BasicHandler {
    public void invoke(MessageContext msgContext) throws AxisFault {
      Debug.Print( 1, "Enter: TCPDispatchHandler::invoke" );
      /* Find the service we're invoking so we can grab it's options */
      /***************************************************************/
      String   targetURL = null ;
      Message  outMsg    = null ;
      String   reqEnv    = null ;
  
      targetURL = msgContext.getStrProp( MessageContext.TRANS_URL);
  System.out.println(targetURL);
      try {
        // This is a totally random, temporary URL specification:
        // http://host:port/service-name ??????? hmmmmmm
        URL      tmpURL = new URL( targetURL );
        String   host   = tmpURL.getHost();
        int      port   = tmpURL.getPort();
        byte[]   buf    = new byte[4097];
        int      rc     = 0 ;
  
        Socket             sock = null ;
  
        /* comment out SSL stuff for now
        
        if (tmpURL.getProtocol().equalsIgnoreCase("https")) {
          if ( (port = tmpURL.getPort()) == -1 ) port = 443;
          String tunnelHost = System.getProperty("https.proxyHost");
          String tunnelPortString = System.getProperty("https.proxyPort");
          String tunnelUsername = System.getProperty("https.proxyUsername");
          String tunnelPassword = System.getProperty("https.proxyPassword");
          try {
            Class SSLSocketFactoryClass =
              Class.forName("javax.net.ssl.SSLSocketFactory");
            Class SSLSocketClass = Class.forName("javax.net.ssl.SSLSocket");
            Method createSocketMethod =
              SSLSocketFactoryClass.getMethod("createSocket",
                                              new Class[] {String.class, Integer.TYPE});
            Method getDefaultMethod =
              SSLSocketFactoryClass.getMethod("getDefault", new Class[] {});
            Method startHandshakeMethod =
              SSLSocketClass.getMethod("startHandshake", new Class[] {});
            Object factory = getDefaultMethod.invoke(null, new Object[] {});
            Object sslSocket = null;
            if (tunnelHost == null || tunnelHost.equals("")) {
              // direct SSL connection
              sslSocket = createSocketMethod .invoke(factory,
                                   new Object[] {host, new Integer(port)});
            } else {
              // SSL tunnelling through proxy server
              Method createSocketMethod2 =
                SSLSocketFactoryClass.getMethod("createSocket",
                                                new Class[] {Socket.class, String.class, Integer.TYPE, Boolean.TYPE});
              int tunnelPort = (tunnelPortString != null? (Integer.parseInt(tunnelPortString) < 0? 443: Integer.parseInt(tunnelPortString)): 443);
              Object tunnel = createSocketMethod .invoke(factory,
                                   new Object[] {tunnelHost, new Integer(tunnelPort)});
              // The tunnel handshake method (condensed and made reflexive)
              OutputStream tunnelOutputStream = (OutputStream)SSLSocketClass.getMethod("getOutputStream", new Class[] {}).invoke(tunnel, new Object[] {});
              PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(tunnelOutputStream)));
              out.print("CONNECT " + host + ":" + port + " HTTP/1.0\n\r\n\r");
              out.flush();
              InputStream tunnelInputStream = (InputStream)SSLSocketClass.getMethod("getInputStream", new Class[] {}).invoke(tunnel, new Object[] {});
              //BufferedReader in = new BufferedReader(new InputStreamReader(tunnelInputStream));
              //DataInputStream in = new DataInputStream(tunnelInputStream);
              Debug.Print(1, "Is tunnelInputStream null? " + String.valueOf(tunnelInputStream == null));
              String replyStr = ""; int i;
              while ((i = tunnelInputStream.read()) != '\n' && i != '\r' && i != -1) { replyStr += String.valueOf((char)i); Debug.Print(1, "got a character in reply, so far: " + replyStr); }
              if (!replyStr.startsWith("HTTP/1.0 200") && !replyStr.startsWith("HTTP/1.1 200")) {
                throw new IOException("Unable to tunnel through " + tunnelHost + ":" + tunnelPort + ".  Proxy returns \"" + replyStr + "\"");
              }
              // End of condensed reflective tunnel handshake method
              sslSocket = createSocketMethod2.invoke(factory,
                                   new Object[] {tunnel, host, new Integer(port), new Boolean(true)});
              Debug.Print( 1, "Set up SSL tunnelling through " + tunnelHost + ":" +tunnelPort);
            }
            // must shake out hidden errors!
            startHandshakeMethod.invoke(sslSocket, new Object[] {});
            sock = (Socket)sslSocket;
          } catch (ClassNotFoundException cnfe) {
            Debug.Print( 1, "SSL feature disallowed: JSSE files not installed or present in classpath");
            throw new AxisFault(cnfe);
          } catch (NumberFormatException nfe) {
            Debug.Print( 1, "Proxy port number, \"" + tunnelPortString + "\", incorrectly formatted");
            throw new AxisFault(nfe);
          }
          Debug.Print( 1, "Created an SSL connection");
        } else {
         */
        
          sock    = new Socket( host, port );
          Debug.Print( 1, "Created an insecure HTTP connection");
        
        /*
        }
         */
  
        reqEnv  = (String) msgContext.getRequestMessage().getAs("String");
        
        //System.out.println("Msg: " + reqEnv);
  
        BufferedInputStream inp = new BufferedInputStream(sock.getInputStream());
        OutputStream  out  = sock.getOutputStream();
        
        /*
        StringBuffer  otherHeaders = new StringBuffer();
        String        userID = null ;
        String        passwd = null ;
  
        userID = msgContext.getStrProp( MessageContext.USERID );
        passwd = msgContext.getStrProp( MessageContext.PASSWORD );
  
        if ( userID != null ) {
          StringBuffer tmpBuf = new StringBuffer();
          tmpBuf.append( userID )
                .append( ":" )
                .append( (passwd == null) ? "" : passwd) ;
          otherHeaders.append( HTTPConstants.HEADER_AUTHORIZATION )
                      .append( ": Basic " )
                      .append( Base64.encode( tmpBuf.toString().getBytes() ) )
                      .append("\n" );
        }
       
        StringBuffer header = new StringBuffer();
  
        header.append( HTTPConstants.HEADER_POST )
              .append(" " )
              .append( ((tmpURL.getFile() == null ||
                         tmpURL.getFile().equals(""))? "/": tmpURL.getFile()) )
              .append( " HTTP/1.0\r\n" )
              .append( HTTPConstants.HEADER_CONTENT_LENGTH )
              .append( ": " )
              .append(reqEnv.length() )
              .append( "\r\n" )
              .append( HTTPConstants.HEADER_CONTENT_TYPE )
              .append( ": text/xml\r\n" )
              .append( (otherHeaders == null ? "" : otherHeaders.toString()) )
              .append( HTTPConstants.HEADER_SOAP_ACTION )
              .append( ": \"" )
              .append( action )
              .append( "\"\r\n\r\n" );
  
        out.write( header.toString().getBytes() );
        
         */
        
        byte[] bytes = reqEnv.getBytes();
        String length = "" + bytes.length + "\r\n";
        out.write(length.getBytes());
        out.write( bytes );
        out.flush();
  
        Debug.Print( 1, "XML sent:" );
        Debug.Print( 1, "---------------------------------------------------");
        Debug.Print( 1, reqEnv );
  
        /*
        byte       lastB=0, b ;
        int        len = 0 ;
        int        colonIndex = -1 ;
        Hashtable  headers = new Hashtable();
        String     name, value ;
  
        // Need to add logic for getting the version # and the return code
        // but that's for tomorrow!
  
        for ( ;; ) {
          if ( (b = (byte) inp.read()) == -1 ) break ;
          if ( b != '\r' && b != '\n' ) {
            if ( b == ':' ) colonIndex = len ;
            lastB = (buf[len++] = b);
          }
          else if ( b == '\r' )
            continue ;
          else {
            if ( len == 0 ) break ;
            if ( colonIndex != -1 ) {
              name = new String( buf, 0, colonIndex );
              value = new String( buf, colonIndex+1, len-1-colonIndex );
            }
            else {
              name = new String( buf, 0, len );
              value = "" ;
            }
            Debug.Print( 1, name + value );
            if ( msgContext.getProperty(HTTPConstants.MC_HTTP_STATUS_CODE)==null){
              // Reader status code
              int start = name.indexOf( ' ' ) + 1 ;
              String tmp = name.substring(start).trim();
              int end   = tmp.indexOf( ' ' );
              if ( end != -1 ) tmp = tmp.substring( 0, end );
              rc = Integer.parseInt( tmp );
              msgContext.setProperty( HTTPConstants.MC_HTTP_STATUS_CODE,
                                      new Integer(rc) );
              msgContext.setProperty( HTTPConstants.MC_HTTP_STATUS_MESSAGE,
                                      name.substring(end+1));
            }
            else
              headers.put( name.toLowerCase(), value );
            len = 0 ;
          }
        }
         */
        if ( Debug.getDebugLevel() > 8 ) {
          // Special case - if the debug level is this high then something
          // really bad must be going on - so just dump the input stream
          // to stdout.
          byte b;
          while ( (b = (byte) inp.read()) != -1 )
            System.err.print((char)b);
          System.err.println("");
        }
  
        outMsg = new Message( inp, "InputStream" );
        if (Debug.getDebugLevel() > 0) {
          Debug.Print( 1, "\nNo Content-Length" );
          Debug.Print( 1, "\nXML received:" );
          Debug.Print( 1, "-----------------------------------------------");
          Debug.Print( 1, (String) outMsg.getAs("String") );
        }
        
        msgContext.setResponseMessage( outMsg );
      }
      catch( Exception e ) {
        Debug.Print( 1, e );
        e.printStackTrace();
        if ( !(e instanceof AxisFault) ) e = new AxisFault(e);
        throw (AxisFault) e ;
      }
      Debug.Print( 1, "Exit: TCPDispatchHandler::invoke" );
    }
  
    public void undo(MessageContext msgContext) {
      Debug.Print( 1, "Enter: TCPDispatchHandler::undo" );
      Debug.Print( 1, "Exit: TCPDispatchHandler::undo" );
    }
  };
  
  
  
  1.33      +45 -32    xml-axis/java/src/org/apache/axis/utils/Admin.java
  
  Index: Admin.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/Admin.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- Admin.java	2001/05/30 20:00:09	1.32
  +++ Admin.java	2001/05/31 09:24:54	1.33
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 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 
  + *    software without prior written permission. For written
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -118,23 +118,23 @@
       }
     }
   
  -  public Document AdminService(MessageContext msgContext, Document xml) 
  +  public Document AdminService(MessageContext msgContext, Document xml)
                     throws AxisFault
     {
       Debug.Print( 1, "Enter: Admin:AdminService" );
       hr = (DefaultHandlerRegistry)msgContext.getProperty(Constants.HANDLER_REGISTRY);
       sr = (DefaultServiceRegistry)msgContext.getProperty(Constants.SERVICE_REGISTRY);
       tmr = msgContext.getTypeMappingRegistry();
  -    Document doc = process( xml );
  +    Document doc = process( msgContext, xml );
       Debug.Print( 1, "Exit: Admin:AdminService" );
       return( doc );
     }
   
  -  public Document process(Document doc) throws AxisFault {
  -    return( process( doc.getDocumentElement() ) );
  +  public Document process(MessageContext msgContext, Document doc) throws AxisFault {
  +    return( process( msgContext, doc.getDocumentElement() ) );
     }
   
  -  public Document process(Element root) throws AxisFault {
  +  public Document process(MessageContext msgContext, Element root) throws AxisFault {
       Document doc = null ;
       try {
         init();
  @@ -142,12 +142,25 @@
         String            action = root.getLocalName();
   
         if ( !action.equals("deploy") && !action.equals("undeploy") &&
  -           !action.equals("list") )
  -        throw new AxisFault( "Admin.error", 
  +           !action.equals("list") && !action.equals("quit") )
  +        throw new AxisFault( "Admin.error",
                                "Root element must be 'deploy', 'undeploy' " +
                                "or 'list'",
                                null, null );
   
  +        if (action.equals("quit")) {
  +            System.err.println("Admin service requested to quit, quitting.");
  +            if (msgContext != null) {
  +                // put a flag into message context so listener will exit after
  +                // sending response
  +                msgContext.setProperty(msgContext.QUIT_REQUESTED, "true");
  +            }
  +              doc = XMLUtils.newDocument();
  +              doc.appendChild( root = doc.createElement( "Admin" ) );
  +              root.appendChild( doc.createTextNode( "Quitting" ) );
  +            return doc;
  +        }
  +        
         if ( action.equals("list") ) {
           String[]   names ;
           Handler    h ;
  @@ -226,8 +239,8 @@
               hr.remove( name );
             }
             else
  -            throw new AxisFault( "Admin.error", 
  -                                 "Unknown type; " + type, 
  +            throw new AxisFault( "Admin.error",
  +                                 "Unknown type; " + type,
                                    null, null );
             continue ;
           }
  @@ -289,7 +302,7 @@
                 hName = st.nextToken();
                 tmpH = hr.find( hName );
                 if ( tmpH == null )
  -                throw new AxisFault( "Admin.error", 
  +                throw new AxisFault( "Admin.error",
                                        "Unknown handler: " + hName,
                                        null, null );
                 c.addHandler( tmpH );
  @@ -310,12 +323,12 @@
     
               st = new StringTokenizer( input, " \t\n\r\f," );
               while ( st.hasMoreElements() ) {
  -              if ( c == null ) 
  +              if ( c == null )
                   cc.setInputChain( c = new SimpleChain() );
                 hName = st.nextToken();
                 tmpH = hr.find( hName );
                 if ( tmpH == null )
  -                throw new AxisFault( "Admin.error", 
  +                throw new AxisFault( "Admin.error",
                                        "Unknown handler: " + hName,
                                        null, null );
                 c.addHandler( tmpH );
  @@ -326,12 +339,12 @@
               st = new StringTokenizer( output, " \t\n\r\f," );
               c  = null ;
               while ( st.hasMoreElements() ) {
  -              if ( c == null ) 
  +              if ( c == null )
                   cc.setOutputChain( c = new SimpleChain() );
                 hName = st.nextToken();
                 tmpH = hr.find( hName );
                 if ( tmpH == null )
  -                throw new AxisFault( "Admin.error", 
  +                throw new AxisFault( "Admin.error",
                                        "Unknown handler: " + hName,
                                        null, null );
                 c.addHandler( tmpH );
  @@ -347,8 +360,8 @@
             Chain                c  = null ;
   
             if ( pivot == null && input == null && output == null )
  -            throw new AxisFault( "Admin.error", 
  -                                 "Services must use targeted chains", 
  +            throw new AxisFault( "Admin.error",
  +                                 "Services must use targeted chains",
                                    null, null );
   
             service = (SOAPService) hr.find( name );
  @@ -365,7 +378,7 @@
                 hName = st.nextToken();
                 tmpH = hr.find( hName );
                 if ( tmpH == null )
  -                throw new AxisFault( "Admin.error", 
  +                throw new AxisFault( "Admin.error",
                                        "Unknown handler: " + hName,
                                        null, null );
                 c.addHandler( tmpH );
  @@ -387,7 +400,7 @@
                 hName = st.nextToken();
                 tmpH = hr.find( hName );
                 if ( tmpH == null )
  -                throw new AxisFault( "Admin.error", 
  +                throw new AxisFault( "Admin.error",
                                        "Unknown handler: " + hName,
                                        null, null );
                 c.addHandler( tmpH );
  @@ -405,8 +418,8 @@
           else if ( type.equals( "bean" ) ) {
             Debug.Print( 2, "Deploying bean: " + name );
             registerTypeMapping(elem, tmr.getParent());
  -        } else 
  -          throw new AxisFault( "Admin.error", 
  +        } else
  +          throw new AxisFault( "Admin.error",
                                  "Unknown type to " + action + ": " + type,
                                  null, null );
         }
  @@ -444,21 +457,21 @@
   
       String qname = elem.getAttribute( "qname" );
       if (qname == null)
  -      throw new AxisFault( "Admin.error", 
  +      throw new AxisFault( "Admin.error",
           "Missing qname in bean " + name, null, null);
   
  -    int pos = qname.indexOf(':'); 
  +    int pos = qname.indexOf(':');
       if (pos < 0)
  -      throw new AxisFault( "Admin.error", 
  -        "Missing namespace in qname " + qname, 
  +      throw new AxisFault( "Admin.error",
  +        "Missing namespace in qname " + qname,
           null, null);
   
       String prefix = qname.substring(0, pos);
       String localPart = qname.substring(pos+1);
  -    String namespace = XMLUtils.getNamespace(prefix, elem); 
  +    String namespace = XMLUtils.getNamespace(prefix, elem);
       if (namespace == null)
  -      throw new AxisFault( "Admin.error", 
  -        "Unknown namespace in qname " + qname, 
  +      throw new AxisFault( "Admin.error",
  +        "Unknown namespace in qname " + qname,
           null, null);
   
       QName qn = new QName(namespace, localPart);
  @@ -501,7 +514,7 @@
       try {
         for ( i = 1 ; i < args.length ; i++ ) {
           System.out.println( "Processing '" + args[i] + "'" );
  -        admin.process(XMLUtils.newDocument( new FileInputStream( args[i] ) ));
  +        admin.process(null, XMLUtils.newDocument( new FileInputStream( args[i] ) ));
         }
       }
       catch( AxisFault e ) {
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/providers/BasicProvider.java
  
  Index: BasicProvider.java
  ===================================================================
  package org.apache.axis.providers;
  
  import java.util.Hashtable;
  import org.apache.axis.handlers.BasicHandler;
  import org.apache.axis.utils.QName;
  
  /**
   * This class has one way of keeping track of the
   * operations declared for a particular service
   * provider.  I'm not exactly married to this though.
   */
  public abstract class BasicProvider extends BasicHandler {
      
      public void addOperation(String name, QName qname) {
          Hashtable operations = (Hashtable)getOption("Operations");
          if (operations == null) {
              operations = new Hashtable();
              addOption("Operations", operations);
          }
          operations.put(qname, name);
      }
      
      public String getOperationName(QName qname) {
          Hashtable operations = (Hashtable)getOption("Operations");
          if (operations == null) return null;
          return (String)operations.get(qname);
      }
      
      public QName[] getOperationQNames() {
          Hashtable operations = (Hashtable)getOption("Operations");
          if (operations == null) return null;
          Object[] keys = operations.keySet().toArray();
          QName[] qnames = new QName[keys.length];
          System.arraycopy(keys,0,qnames,0,keys.length);
          return qnames;
      }
      
      public String[] getOperationNames() {
          Hashtable operations = (Hashtable)getOption("Operations");
          if (operations == null) return null;
          Object[] values = operations.values().toArray();
          String[] names = new String[values.length];
          System.arraycopy(values,0,names,0,values.length);
          return names;
      }
      
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/providers/BSFProvider.java
  
  Index: BSFProvider.java
  ===================================================================
  package org.apache.axis.providers;
  
  import org.apache.axis.MessageContext;
  
  public class BSFProvider extends BasicProvider {
  
      public static final String OPTION_LANGUAGE = "Language";
      public static final String OPTION_SRC = "Src";
      public static final String OPTION_SCRIPT = "Script";
      
      public void invoke(MessageContext msgContext) {
          System.out.println(getOption("Script"));
      }
  
      public void undo(MessageContext msgContext) {
      }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/providers/ComProvider.java
  
  Index: ComProvider.java
  ===================================================================
  package org.apache.axis.providers;
  
  import org.apache.axis.MessageContext;
  
  public class ComProvider extends BasicProvider {
      
      public static final String OPTION_PROGID = "ProgID";
      public static final String OPTION_CLSID = "CLSID";
      public static final String OPTION_THREADING_MODEL = "threadingModel";
      
      public void invoke(MessageContext msgContext) {
      }
  
      public void undo(MessageContext msgContext) {
      }
      
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/providers/JWSProvider.java
  
  Index: JWSProvider.java
  ===================================================================
  package org.apache.axis.providers;
  
  import org.apache.axis.MessageContext;
  
  public class JWSProvider extends BasicProvider {
      
      public void invoke(MessageContext msgContext) {
      }
  
      public void undo(MessageContext msgContext) {
      }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/providers/java/JavaProvider.java
  
  Index: JavaProvider.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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.providers.java;
  
  import java.util.* ;
  import java.lang.reflect.* ;
  import org.apache.axis.* ;
  import org.apache.axis.utils.* ;
  import org.apache.axis.utils.cache.* ;
  import org.apache.axis.message.* ;
  import org.apache.axis.providers.BasicProvider;
  
  /**
   * Base class for Java dispatching.  Fetches various fields out of envelope,
   * looks up service object (possibly using session state), and delegates
   * envelope body processing to subclass via abstract processMessage method.
   *
   * @author Doug Davis (dug@us.ibm.com)
   */
  public abstract class JavaProvider extends BasicProvider {
      
      // from the original stubbed-out JavaProvider...
      // not quite sure what these are for but it is to do with WSDD... -- RobJ
      public static final String OPTION_CLASSNAME = "className";
      public static final String OPTION_IS_STATIC = "isStatic";
      public static final String OPTION_CLASSPATH = "classPath";
      
      private static final boolean DEBUG_LOG = false;
      
      /**
       * Get the service object whose method actually provides the service.
       * May look up in session table.
       */
      public Object getServiceObject (MessageContext msgContext, String clsName, String methodName, JavaClass jc)
          throws Exception
      {
          // default is just to get new instance, for now
          // soon, session support here
          return jc.getJavaClass().newInstance();
      }
      
      
      /**
       * Process the current message.  Side-effect resEnv to create return value.
       *
       * @param msgContext self-explanatory
       * @param clsName the class name of the ServiceHandler
       * @param methodName the method name of ditto
       * @param reqEnv the request envelope
       * @param resEnv the response envelope
       * @param jc the JavaClass of the service object
       * @param obj the service object itself
       */
      public abstract void processMessage (MessageContext msgContext,
                                           String clsName,
                                           String methodName,
                                           SOAPEnvelope reqEnv,
                                           SOAPEnvelope resEnv,
                                           JavaClass jc,
                                           Object obj)
          throws Exception;
      
      
      /**
       * Invoke the message by obtaining various common fields, looking up
       * the service object (via getServiceObject), and actually processing
       * the message (via processMessage).
       */
      public void invoke(MessageContext msgContext) throws AxisFault {
          Debug.Print( 1, "Enter: JavaProvider::invoke (for provider "+this+")" );
          
          /* Find the service we're invoking so we can grab it's options */
          /***************************************************************/
          String serviceName = msgContext.getTargetService();
          Handler service = msgContext.getServiceHandler();
          
          /* Now get the service (RPC) specific info  */
          /********************************************/
          String  clsName    = (String) service.getOption( "className" );
          String  methodName = (String) service.getOption( "methodName" );
          
          try {
              /* We know we're doing a Java/RPC call so we can ask for the */
              /* SOAPBody as an RPCBody and process it accordingly.        */
              /*************************************************************/
              int             i ;
              AxisClassLoader cl     = msgContext.getClassLoader();
              JavaClass       jc     = cl.lookup(clsName);
              Class           cls    = jc.getJavaClass();
              Object          obj    = getServiceObject(msgContext, clsName, methodName, jc);
              
              Message         reqMsg  = msgContext.getRequestMessage();
              SOAPEnvelope    reqEnv  = (SOAPEnvelope) reqMsg.getAs("SOAPEnvelope");
              Message         resMsg  = msgContext.getResponseMessage();
              SOAPEnvelope    resEnv  = (resMsg == null) ?
                  new SOAPEnvelope() :
                  (SOAPEnvelope)resMsg.getAs("SOAPEnvelope");
              
              processMessage(msgContext, serviceName, methodName, reqEnv, resEnv, jc, obj);
              
              if (resMsg == null) {
                  resMsg = new Message(resEnv, "SOAPEnvelope");
                  msgContext.setResponseMessage( resMsg );
              }
          }
          catch( Exception exp ) {
              Debug.Print( 1, exp );
              if ( !(exp instanceof AxisFault) ) exp = new AxisFault(exp);
              throw (AxisFault) exp ;
          }
          Debug.Print( 1, "Exit: JavaProvider::invoke (for provider "+this+")" );
      }
      
      
      public void undo(MessageContext msgContext) {
          Debug.Print( 1, "Enter: RPCDispatchHandler::undo" );
          Debug.Print( 1, "Exit: RPCDispatchHandler::undo" );
      }
      
  };
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/providers/java/MsgProvider.java
  
  Index: MsgProvider.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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.providers.java;
  
  import java.io.* ;
  import java.util.* ;
  import java.lang.reflect.* ;
  import org.apache.axis.* ;
  import org.apache.axis.utils.* ;
  import org.apache.axis.utils.cache.JavaClass;
  import org.apache.axis.encoding.SerializationContext;
  import org.apache.axis.encoding.ServiceDescription;
  import org.apache.axis.message.DOMBody;
  import org.apache.axis.message.SOAPBodyElement;
  import org.apache.axis.message.SOAPEnvelope;
  import org.apache.axis.message.SOAPHeader;
  import org.apache.axis.handlers.* ;
  
  import org.w3c.dom.* ;
  import org.xml.sax.*;
  
  /**
   *
   * @author Doug Davis (dug@us.ibm.com)
   */
  public class MsgProvider extends JavaProvider {
      /**
       * This is pretty much a pass-thru to the util.Admin tool.  This will just
       * take the Request xml file and call the Admin processing.
       */
      public void processMessage (MessageContext msgContext,
                                  String clsName,
                                  String methodName,
                                  SOAPEnvelope reqEnv,
                                  SOAPEnvelope resEnv,
                                  JavaClass jc,
                                  Object obj)
          throws Exception
      {
          Class[]         argClasses = new Class[2];
          Object[]        argObjects = new Object[2];
          
          /** !!! KLUDGE WARNING
           * We need some way of associating ServiceDescriptions with actual
           * services... and then at the point when we figure out which service
           * we'll be calling (which might be right away (static dispatch), after
           * looking at the URL (transport-level dispatch), or even after looking
           * into the SOAP message itself...)
           */
          if (clsName.equals("org.apache.axis.utils.Admin")) {
              ServiceDescription sd = new ServiceDescription("Admin", false);
              msgContext.setServiceDescription(sd);
          }
          
          SOAPBodyElement reqBody = reqEnv.getFirstBody();
          
          StringWriter writer = new StringWriter();
          reqBody.output(new SerializationContext(writer, msgContext));
          
          Reader reader = new StringReader(writer.getBuffer().toString());
          Document doc = XMLUtils.newDocument(new InputSource(reader));
          
          // !!! WANT TO MAKE THIS SAX-CAPABLE AS WELL.  Some people will
          //     want DOM, but our examples should mostly lean towards the
          //     SAX side of things....
          
          /* If no methodName was specified during deployment then get it */
          /* from the root of the Body element                            */
          /* Hmmm, should we do this????                                  */
          /****************************************************************/
          if ( methodName == null || methodName.equals("") ) {
              Element root = doc.getDocumentElement();
              if ( root != null ) methodName = root.getLocalName();
          }
          
          argClasses[0] = msgContext.getClassLoader().loadClass("org.apache.axis.MessageContext");
          argClasses[1] = msgContext.getClassLoader().loadClass("org.w3c.dom.Document");
          argObjects[0] = msgContext ;
          argObjects[1] = doc ;
          
          Method       method = jc.getJavaClass().getMethod( methodName, argClasses );
          
          Document retDoc = (Document) method.invoke( obj, argObjects );
          
          if ( retDoc != null ) {
              SOAPBodyElement el = new DOMBody(retDoc.getDocumentElement());
              resEnv.addBodyElement(el);
          }
      }
      
      
      public void undo(MessageContext msgContext) {
          Debug.Print( 1, "Enter: MsgDispatcherHandler::undo" );
          Debug.Print( 1, "Exit: MsgDispatcherHandler::undo" );
      }
  };
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/providers/java/RPCProvider.java
  
  Index: RPCProvider.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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.providers.java ;
  
  import java.util.* ;
  import java.lang.reflect.* ;
  import org.apache.axis.* ;
  import org.apache.axis.utils.* ;
  import org.apache.axis.utils.cache.* ;
  import org.apache.axis.message.* ;
  
  /**
   * Implement message processing by walking over RPCElements of the
   * envelope body, invoking the appropriate methods on the service object.
   *
   * @author Doug Davis (dug@us.ibm.com)
   */
  public class RPCProvider extends JavaProvider {
      private static final boolean DEBUG_LOG = false;
      
      public void processMessage (MessageContext msgContext,
                                  String clsName,
                                  String methodName,
                                  SOAPEnvelope reqEnv,
                                  SOAPEnvelope resEnv,
                                  JavaClass jc,
                                  Object obj)
          throws Exception
      {
          Vector          bodies = reqEnv.getBodyElements();
          
          /* Loop over each entry in the SOAPBody - each one is a different */
          /* RPC call.                                                      */
          /******************************************************************/
          for ( int bNum = 0 ; bNum < bodies.size() ; bNum++ ) {
              if (!(bodies.get(bNum) instanceof RPCElement))
                  continue;
              
              RPCElement   body  = (RPCElement) bodies.get( bNum );
  
              /* This breaks JWS.  With JWS, the service name is JWSProcessor,
                 but the URN is the actual service name.  hmmmmm.
              
              // validate that the incoming targetService is the same as the
              // namespace URI of the body... if not, someone spoofed the
              // SOAPAction header (or equivalent)
              if (body.getNamespaceURI() != null
                  && !body.getNamespaceURI().equals(msgContext.getTargetService()))
              {
                  throw new AxisFault( "AxisServer.error",
                                      "Incoming target service name doesn't match body namespace URI\n" +
                                          "Target service name=" + msgContext.getTargetService() + "\n" +
                                          "Body URI=" + body.getNamespaceURI(),
                                      null, null );  // should they??
              }
               */
              
              
              String       mName = body.getMethodName();
              Vector       args  = body.getParams();
              
              if ( methodName != null && !methodName.equals(mName) )
                  throw new AxisFault( "AxisServer.error",
                                      "Method names don't match\n" +
                                          "Body name=" + mName + "\n" +
                                          "Service name=" + methodName,
                                      null, null );  // should they??
              
              Debug.Print( 2, "mName: " + mName );
              Debug.Print( 2, "MethodName: " + methodName );
              Method       method = jc.getMethod(mName, args.size());
              if ( method == null )
                  throw new AxisFault( "AxisServer.error",
                                      "Method not found\n" +
                                          "Method name=" + methodName + "\n" +
                                          "Service name=" + msgContext.getTargetService(),
                                      null, null );
              
              Object[] argValues  =  null ;
              
              if ( args != null && args.size() > 0 ) {
                  argValues = new Object[ args.size()];
                  for ( int i = 0 ; i < args.size() ; i++ ) {
                      argValues[i]  = ((RPCParam)args.get(i)).getValue() ;
                      
                      if (DEBUG_LOG) {
                          System.out.println("  value: " + argValues[i] );
                      }
                  }
              }
              
              Object objRes = method.invoke( obj, argValues );
              
              /* Now put the result in the result SOAPEnvelope */
              /*************************************************/
              RPCElement resBody = new RPCElement(mName + "Response");
              resBody.setPrefix( body.getPrefix() );
              resBody.setNamespaceURI( body.getNamespaceURI() );
              if ( objRes != null ) {
                  RPCParam param = new RPCParam("return", objRes);
                  resBody.addParam(param);
              }
              resEnv.addBodyElement( resBody );
          }
      }
  }
  
  
  
  1.1                  xml-axis/java/test/build_ant.xml
  
  Index: build_ant.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <!-- ===================================================================
  
     Build file for Axis functional test Ant task
  
  Notes:
     This is a build file for use with the Jakarta Ant build tool.
     This build file builds an Ant task used to perform Axis functional tests.
  
  Prerequisites:
  
     a successful Axis build configuration
     
  Author:
    Rob Jellinghaus <robj@unrealities.com>
  
  Copyright:
    Copyright (c) 2001 Apache Software Foundation.
  
  ==================================================================== -->
  
  <project default="buildAntTask" basedir=".">
  
    <path id="test-classpath">
      <!-- build.dir for test classes and build.dest for classes to test -->
      <pathelement location="${build.dir}" />
      <pathelement location="${build.dest}" />
      <pathelement path="${java.class.path}" />
    </path>
  
    <!--
    I am not sure how else to get this optional-ant-task class onto
    the Ant classpath.  I know that environment is system-dependent, though it
    should work on both Unix and Windows.
    Any thoughts?
    -->
    <property name="myenv" environment="myenv" />
    <property name="ant.dir" value="${myenv.ANT_HOME}/lib" />
  
    <!-- =================================================================== -->
    <!-- Build the Ant task for Axis functional testing.  Put the resulting  -->
    <!-- Ant task class into the Ant lib directory (where extension tasks    -->
    <!-- ought to go).                                                       -->
    <!-- Hope that the user has ANT_HOME/lib on their Ant path.              -->
    <!-- =================================================================== -->
    <target name="buildAntTask" if="junit.present">
      <echo message="ant.dir is ${ant.dir}" />
      <!-- Tests are packaged as test.*, so source dir is main dir -->
      <javac srcdir="${basedir}"
        destdir="${ant.dir}">
        <include name="test/functional/ant/*.java" />
        <classpath refid="test-classpath" />
      </javac>
    </target>
  
  </project>
  
  
  
  
  1.1                  xml-axis/java/test/build_functional_tests.xml
  
  Index: build_functional_tests.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <!-- ===================================================================
  
     Build file for Axis functional test Ant task
  
  Notes:
     This is a build file for use with the Jakarta Ant build tool.
     This build file builds an Ant task used to perform Axis functional tests.
  
  Prerequisites:
  
     a successful Axis build configuration
     
  Author:
    Rob Jellinghaus <robj@unrealities.com>
  
  Copyright:
    Copyright (c) 2001 Apache Software Foundation.
  
  ==================================================================== -->
  
  <project default="functional-tests" basedir=".">
  
    <path id="test-classpath">
      <!-- build.dir for test classes and build.dest for classes to test -->
      <pathelement location="${build.dir}" />
      <pathelement location="${build.dest}" />
      <pathelement path="${java.class.path}" />
    </path>
  
    <taskdef name="runaxisfunctionaltests" classname="test.functional.ant.RunAxisFunctionalTestsTask" />
  
    <!-- =================================================================== -->
    <!-- Launches the functional test TCP server -->
    <!-- =================================================================== -->
    <target name="start-functional-test-tcp-server" if="junit.present">
      <echo message="Starting test tcp server."/>
      <java classname="org.apache.axis.transport.tcp.AxisListener" fork="yes" dir="./build">
        <arg line="-p 8088" /> <!-- arbitrary port -->
        <classpath refid="test-classpath" />
      </java>
    </target>
  
    <!-- =================================================================== -->
    <!-- Launches the functional test HTTP server -->
    <!-- =================================================================== -->
    <target name="start-functional-test-http-server" if="junit.present">
      <echo message="Starting test http server."/>
      <java classname="org.apache.axis.transport.http.SimpleAxisServer" fork="yes" dir="./build">
        <classpath refid="test-classpath" />
      </java>
    </target>
    
    <!-- =================================================================== -->
    <!-- Runs the JUnit functional test -->
    <!-- =================================================================== -->
    <target name="junit-functional" if="junit.present">
      <junit printsummary="yes" haltonfailure="yes" fork="yes">
        <classpath refid="test-classpath" />
        <formatter type="plain" />
        <batchtest>
          <fileset dir="${build.dir}">
            <!-- Convention: each package that's being tested
                  has its own test class collecting all the tests -->
            <include name="**/FunctionalTests.class" />
          </fileset>
        </batchtest>
      </junit>
    </target>
    
    <!-- =================================================================== -->
    <!-- Stops the functional test HTTP server -->
    <!-- =================================================================== -->
    <target name="stop-functional-test-http-server" if="junit.present">
      <echo message="Stopping test http server."/>
      <java classname="org.apache.axis.client.http.HTTPAdminClient" fork="yes">
        <classpath refid="test-classpath" />
        <arg line="quit"/>
      </java>
    </target>
    
    <!-- =================================================================== -->
    <!-- Run functional tests                                                -->
    <!-- =================================================================== -->
    <target name="functional-tests" if="junit.present">
      <!-- This uses a custom Ant task.  See test/functional/ant/RunAxisFunctionalTests.java -->
      <!-- This pattern taken from Cactus, http://jakarta.apache.org/commons/cactus -->
      <runaxisfunctionaltests
        url="http://localhost:8088"
        startTarget1="start-functional-test-tcp-server"
        startTarget2="start-functional-test-http-server"
        testTarget="junit-functional"
        stopTarget="stop-functional-test-http-server" />
    </target>
    
    <!-- =================================================================== -->
    <!-- Runs the JUnit functional test, with special class parameter.       -->
    <!-- This is because RobJ's IDE can't build into multiple directories;   -->
    <!-- it builds all the tests & samples into build/classes.               -->
    <!-- If he wants to build & run the server under the debugger while      -->
    <!-- firing the client tests at it, he has to use this target so junit   -->
    <!-- will find the classes in the IDE's build location.                  -->
    <!-- =================================================================== -->
    <target name="junit-functional-noserver" if="junit.present">
      <junit printsummary="yes" haltonfailure="yes" fork="yes">
        <classpath refid="test-classpath" />
        <formatter type="plain" />
        <batchtest>
          <fileset dir="${build.dir}/classes">
            <!-- Convention: each package that's being tested
                  has its own test class collecting all the tests -->
            <include name="**/FunctionalTests.class" />
          </fileset>
        </batchtest>
      </junit>
    </target>
  
  
  </project>
  
  
  
  
  
  1.1                  xml-axis/java/test/functional/FunctionalTests.java
  
  Index: FunctionalTests.java
  ===================================================================
  package test.functional;
  
  import junit.framework.TestCase;
  import junit.framework.Test;
  import junit.framework.TestSuite;
  
  /**
   * soapenc's FunctionalTests test client/server interactions.
   */
  public class FunctionalTests extends TestCase
  {
      public FunctionalTests(String name)
      {
          super(name);
  System.out.println("Creating FunctionalTests(name)");
      }
  
      public static Test suite() throws Exception
      {
  System.out.println("Creating FunctionalTests suite.");
          TestSuite suite = new TestSuite();
  
          //suite.addTestSuite(TestTCPEcho.class);
          suite.addTestSuite(TestHTTPEcho.class);
  
          return suite;
      }
  }
  
  
  
  1.1                  xml-axis/java/test/functional/TestHTTPEcho.java
  
  Index: TestHTTPEcho.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 test.functional;
  
  import java.net.*;
  import java.io.*;
  import java.util.*;
  
  import org.apache.axis.AxisFault ;
  import org.apache.axis.client.http.HTTPAdminClient;
  import org.apache.axis.utils.Debug ;
  import org.apache.axis.utils.Options ;
  import org.apache.axis.utils.QName ;
  import org.apache.axis.encoding.ServiceDescription;
  import org.apache.axis.encoding.SOAPTypeMappingRegistry;
  
  import junit.framework.TestCase;
  
  import samples.stock.GetQuote;
  
  /** Little serialization test with a struct.
   */
  public class TestHTTPEcho extends TestCase {
      
      public TestHTTPEcho(String name) {
          super(name);
  System.out.println("TestHTTPEcho() "+new File(".").getAbsolutePath()+" "+new File(".").getPath());
      }
      
      public void doTestDeploy () throws Exception {
          try {
              String[] args = { "samples/stock/deploy.xml" };
              new HTTPAdminClient().doAdmin(args);
          }
          catch( Exception e ) {
              if ( e instanceof AxisFault ) ((AxisFault)e).dump();
              e.printStackTrace();
              throw new Exception("TestHTTPEcho.doTestDeploy: Fault returned from echo test: "+e);
          }
      }
      
      public void doTestStock () throws Exception {
          try {
              String[] args = { "-d3", "-uuser1", "-wpass1", "XXX" };
              float val = new GetQuote().getQuote(args);
              assertEquals("TestHTTPEcho: stock price is 55.25", val, 55.25, 0.01);
          }
          catch( Exception e ) {
              if ( e instanceof AxisFault ) ((AxisFault)e).dump();
              e.printStackTrace();
              throw new Exception("TestHTTPEcho.doTestStock: Fault returned from echo test: "+e);
          }
      }
      
      public void doTestUndeploy () throws Exception {
          try {
              String[] args = { "samples/stock/undeploy.xml" };
              new HTTPAdminClient().doAdmin(args);
          }
          catch( Exception e ) {
              if ( e instanceof AxisFault ) ((AxisFault)e).dump();
              e.printStackTrace();
              throw new Exception("TestHTTPEcho.doTestUndeploy: Fault returned from echo test: "+e);
          }
      }
      
      
      public void testStockService () throws Exception {
          System.out.println("Testing stock service.");
          System.out.println("Testing deployment...");
          doTestDeploy();
          System.out.println("Testing service...");
          doTestStock();
          System.out.println("Testing undeployment...");
          doTestUndeploy();
          System.out.println("Test complete.");
          
          
          
              // second, and more involvedly, stop the http server
              // Try connecting in case the server is already stopped.
              URL url = new URL("http://localhost:8080");
              try {
                  HttpURLConnection connection = (HttpURLConnection)url.openConnection();
                  connection.connect();
                  this.readFully(connection);
                  connection.disconnect();
              } catch (IOException e) {
                  // Server is not running. Make this task a no-op.
                  return;
              }
              
          
      }
      /**
       * Read all the contents that are to be read
       */
      static void readFully(HttpURLConnection connection) throws IOException
      {
          // finish reading it to prevent (harmless) server-side exceptions
          BufferedInputStream is = new BufferedInputStream(connection.getInputStream());
          byte[] buffer = new byte[256];
          while((is.read(buffer)) > 0) {}
          is.close();
      }
  
  }
  
  
  
  
  1.1                  xml-axis/java/test/functional/TestTCPEcho.java
  
  Index: TestTCPEcho.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 test.functional;
  
  import java.net.*;
  import java.io.*;
  import java.util.*;
  
  import org.apache.axis.AxisFault ;
  import org.apache.axis.client.ServiceClient ;
  import org.apache.axis.client.tcp.TCPClient;
  import org.apache.axis.utils.Debug ;
  import org.apache.axis.utils.Options ;
  import org.apache.axis.utils.QName ;
  import org.apache.axis.encoding.ServiceDescription;
  import org.apache.axis.encoding.SOAPTypeMappingRegistry;
  
  import junit.framework.TestCase;
  
  /** Little serialization test with a struct.
   */
  public class TestTCPEcho extends TestCase {
    
    public TestTCPEcho(String name) {
      super(name);
    }
    
    public void testData() throws Exception {
      try {
        /*
         Options opts = new Options( args );
        
        Debug.setDebugLevel( opts.isFlagSet( 'd' ) );
        
        args = opts.getRemainingArgs();
         
        if ( args == null ) {
          System.err.println( "Usage: GetQuoteTCP -h <host> -p <port> <symbol>" );
          System.exit(1);
        }
         */
        String   symbol = "XXX"; // args[0] ;
        URL url = null;
        // parse host, port out of URL by hand
        // what to do about that URL format issue.....
        try {
          url = new URL("http://localhost:8088"); // (opts.getURL());
        } catch (IOException ex) {
          System.err.println("URL "+url+" hosed: "+ex);
          System.exit(1);
        }
        
        ServiceClient call   = new ServiceClient( new TCPClient() );
        call.set(TCPClient.HOST, url.getHost());
        call.set(TCPClient.PORT, ""+url.getPort());
        
        // reconstruct URL
        ServiceDescription sd = new ServiceDescription("stockQuotes", true);
        sd.addOutputParam("return", SOAPTypeMappingRegistry.XSD_FLOAT);
        call.setServiceDescription(sd);
        
        // if ( opts.isFlagSet('t') > 0 ) call.doLocal = true ;
        
        /*
         call.setUserID( opts.getUser() );
         call.setPassword( opts.getPassword() );
         */
        
        // useful option for profiling - perhaps we should remove before
        // shipping?
        /*
         String countOption = opts.isValueSet('c');
        int count=1;
        if ( countOption != null) {
          count=Integer.valueOf(countOption).intValue();
          System.out.println("Iterating " + count + " times");
         }
         */
        
        Float res = new Float(0.0F);
  //      for (int i=0; i<count; i++) {
          Object ret = call.invoke(
            "urn:xmltoday-delayed-quotes", "getQuote",
            new Object[] {symbol} );
          if (ret instanceof Float) {
            res = (Float) ret;
            // System.out.println( symbol + ": " + res );
            assertEquals("TestTCPEcho: stock price is 55.25", res.floatValue(), 55.25, 0.000001);
          } else {
            throw new Exception("Bad return value from echo test: "+ret);
          }
        }
        
  //    }
      catch( Exception e ) {
        if ( e instanceof AxisFault ) ((AxisFault)e).dump();
        e.printStackTrace();
        throw new Exception("Fault returned from echo test: "+e);
      }
    }
  }
  
  
  
  
  1.1                  xml-axis/java/test/functional/ant/RunAxisFunctionalTestsTask.java
  
  Index: RunAxisFunctionalTestsTask.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 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 acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Ant", 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 names without prior written
   *    permission of the Apache Group.
   *
   * 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 test.functional.ant;
  
  import java.net.*;
  import java.io.*;
  
  import org.apache.tools.ant.*;
  import org.apache.tools.ant.taskdefs.*;
  
  /**
   * Ant task for starting / stopping servers and running junit in the middle.
   * Based on the Cactus org.apache.commons.cactus.ant package, heavily munged
   * and cruftily dumped into one file.
   *
   * @author Rob Jellinghaus (robj@unrealities.com)
   */
  public class RunAxisFunctionalTestsTask extends Task
  {
      private String startTarget1;
      private String startTarget2;
      private String testTarget;
      private String stopTarget;
      private URL url;
      
      /**
       * Executes the task.
       */
      public void execute() throws BuildException
      {
          try {
              callStart(startTarget1);
              callStart(startTarget2);
              callTests();
          } finally {
              // Make sure we stop the server
              callStop();
          }
      }
      
      /**
       * Call the start server task
       */
      private void callStart(String startTarget)
      {
          new Thread(new TaskRunnable(startTarget)).start();
          // try a ping
          while (true) {
              try {
                  Thread.currentThread().sleep(500);
              } catch (InterruptedException ex) {
              }
              try {
                  sendOnSocket("ping\r\n");
                  // if no exception, return
                  System.out.println("RunAxisFunctionalTestsTask.callStart successfully pinged server.");
                  return;
              } catch (Exception ex) {
                  // loop & try again
              }
          }
          
          // NOTREACHED since the while loop returns if it successfully pings
      }
      
      /**
       * Call the run tests target
       */
      private void callTests()
      {
          antcall(testTarget);
      }
      
      /**
       * Call the stop server task
       */
      private void callStop()
      {
          try {
              // first, stop the tcp server
              sendOnSocket("quit\r\n");
              
              // second, and more involvedly, stop the http server
              // Try connecting in case the server is already stopped.
              URL url = new URL("http://localhost:8080");
              try {
                  HttpURLConnection connection = (HttpURLConnection)url.openConnection();
                  connection.connect();
                  this.readFully(connection);
                  connection.disconnect();
              } catch (IOException e) {
                  // Server is not running. Make this task a no-op.
                  return;
              }
              
              // Call the target that stops the server
              antcall(stopTarget);
              
              // Wait a few ms more (just to make sure)
              try {
                  Thread.sleep(500);
              } catch (InterruptedException e) {
                  throw new BuildException("Interruption during sleep", e);
              }
              
              /*
               // Continuously try calling the test URL until it fails
              while (true) {
  System.out.println("Trying localhost:8080...");
                  try {
                      HttpURLConnection connection = (HttpURLConnection)url.openConnection();
                      connection.connect();
                      this.readFully(connection);
                      connection.disconnect();
                  } catch (IOException e) {
                      break;
                  }
                  
                  try {
                      Thread.sleep(500);
                  } catch (InterruptedException ee) {
                      throw new BuildException("Interruption during sleep", ee);
                  }
                  
              }
              
              // Wait a few ms more (just to be sure !)
              try {
                  Thread.sleep(500);
              } catch (InterruptedException e) {
                  throw new BuildException("Interruption during sleep", e);
              }
               */
              System.out.println("RunAxisFunctionalTestsTask.callStop successfully sent quit message.");
          } catch (Exception ex) {
              // ignore; if socket not there, presume dead already
          }
      }
      
      
      /**
       * Call the selected ant task.
       */
      private void antcall (String taskName) {
          CallTarget callee;
          callee = (CallTarget)project.createTask("antcall");
          callee.setOwningTarget(target);
          callee.setTaskName(getTaskName());
          callee.setLocation(location);
          callee.init();
          callee.setTarget(taskName);
          callee.execute();
      }
      
      /**
       * Make a socket to the url, and send the given string
       */
      private void sendOnSocket (String str) throws Exception {
          Socket sock = null;
          try {
              sock = new Socket(url.getHost(), url.getPort());
              sock.getOutputStream().write(new String(str).getBytes());
              // get a single byte response
              int i = sock.getInputStream().read();
          } catch (Exception ex) {
              throw ex;
          }/* finally {
              if (sock != null) {
                  try {
                      sock.close();
                  } catch (IOException ex) {
                      // ignore
                  }
              }
           }*/
      }
      
      
      /**
       * Read all the contents that are to be read
       */
      static void readFully(HttpURLConnection connection) throws IOException
      {
          // finish reading it to prevent (harmless) server-side exceptions
          BufferedInputStream is = new BufferedInputStream(connection.getInputStream());
          byte[] buffer = new byte[256];
          while((is.read(buffer)) > 0) {}
          is.close();
      }
  
      /**
       * Sets the target to call to start server 1.
       *
       * @param theStartTarget the Ant target to call
       */
      public void setStartTarget1(String theStartTarget)
      {
          startTarget1 = theStartTarget;
      }
      
      /**
       * Sets the target to call to start server 2.
       *
       * @param theStartTarget the Ant target to call
       */
      public void setStartTarget2(String theStartTarget)
      {
          startTarget2 = theStartTarget;
      }
      
      /**
       * Sets the target to call to run the tests.
       *
       * @param theTerstTarget the Ant target to call
       */
      public void setTestTarget(String theTestTarget)
      {
          testTarget = theTestTarget;
      }
      
      /**
       * Sets the stop target.  This is the target which does
       * a HTTP admin shutdown on the simple server.
       */
      public void setStopTarget (String theStopTarget)
      {
          stopTarget = theStopTarget;
      }
      
      /**
       * Sets the target URL (just http://host:port)
       */
      public void setUrl (String theUrl) {
          try {
              url = new URL(theUrl);
          } catch (MalformedURLException ex) {
              System.err.println("Can't make URL from "+theUrl);
          }
      }
      
      
      /**
       * Helper class to execute a task in a thread.
       */
      public class TaskRunnable implements Runnable
      {
          String taskName;
          public TaskRunnable (String taskName) {
              this.taskName = taskName;
          }
          public void run () {
              antcall(taskName);
          }
      }
  }
  
  
  
  
  

Mime
View raw message