You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by du...@apache.org on 2001/03/31 02:53:11 UTC

cvs commit: xml-axis/java/webapps/axis StockQuoteService.jws

dug         01/03/30 16:53:11

  Modified:    java/samples/stock testit.cmd
               java/src/org/apache/axis AxisFault.java
                        FaultableHandler.java Handler.java Message.java
                        SimpleChain.java SimpleTargetedChain.java
               java/src/org/apache/axis/client AxisClient.java
                        HTTPMessage.java
               java/src/org/apache/axis/handlers BasicHandler.java
                        JWSProcessor.java MsgDispatchHandler.java
               java/src/org/apache/axis/message RPCArg.java RPCBody.java
                        SOAPEnvelope.java
               java/src/org/apache/axis/registries
                        DefaultHandlerRegistry.java
                        DefaultServiceRegistry.java
               java/src/org/apache/axis/transport/http
                        HTTPDispatchHandler.java
               java/src/org/apache/axis/utils Admin.java
  Added:       java/webapps/axis StockQuoteService.jws
  Log:
  MOved some things to be in XMLUtils
  Added a test for StockQuoteService.jws
  
  Revision  Changes    Path
  1.4       +3 -0      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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- testit.cmd	2001/03/08 23:27:10	1.3
  +++ testit.cmd	2001/03/31 00:53:08	1.4
  @@ -1,6 +1,9 @@
   rem this assumes webserver is running on port 8080
   rem this assumes that the samples/xml/init.xml file has already been deployed
   
  +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
   
  
  
  
  1.16      +3 -16     xml-axis/java/src/org/apache/axis/AxisFault.java
  
  Index: AxisFault.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/AxisFault.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- AxisFault.java	2001/03/30 19:26:13	1.15
  +++ AxisFault.java	2001/03/31 00:53:08	1.16
  @@ -145,24 +145,11 @@
       return( (Element[]) faultDetails.toArray() );
     }
   
  -  public Element getElement() {
  +  public Element getElement(Document doc) {
       Element  elem, root ;
       int      i ;
   
  -    DocumentBuilderFactory dbf = null ;
  -    DocumentBuilder        db  = null ;
  -    Document               doc = null ;
  -
  -    try {
  -      dbf = DocumentBuilderFactory.newInstance();
  -      dbf.setNamespaceAware(true);
  -      db  = dbf.newDocumentBuilder();
  -      doc = db.newDocument();
  -    }
  -    catch( Exception e ) {
  -      e.printStackTrace();
  -    }
  -    
  +    if ( doc == null ) doc = XMLUtils.newDocument();
       root = doc.createElementNS( Constants.URI_SOAP_ENV,
                                   Constants.NSPREFIX_SOAP_ENV + ":" +
                                   Constants.ELEM_FAULT );
  @@ -182,7 +169,7 @@
         root.appendChild(elem = doc.createElement( Constants.ELEM_FAULT_DETAIL));
   
         for ( i = 0 ;i < faultDetails.size() ; i++ )
  -        elem.appendChild( (Element) faultDetails.get(i) );
  +        elem.appendChild( doc.importNode((Element) faultDetails.get(i),true) );
       }
   
       return( root );
  
  
  
  1.12      +1 -15     xml-axis/java/src/org/apache/axis/FaultableHandler.java
  
  Index: FaultableHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/FaultableHandler.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- FaultableHandler.java	2001/03/30 17:48:34	1.11
  +++ FaultableHandler.java	2001/03/31 00:53:08	1.12
  @@ -146,22 +146,8 @@
       options = opts ;
     }
   
  -  public Element getDeploymentData() {
  +  public Element getDeploymentData(Document doc) {
       Debug.Print( 1, "Enter: FaultableHandler::getDeploymentData" );
  -
  -    DocumentBuilderFactory dbf = null ;
  -    DocumentBuilder        db  = null ;
  -    Document               doc = null ;
  -   
  -    try {
  -      dbf = DocumentBuilderFactory.newInstance();
  -      dbf.setNamespaceAware(true);
  -      db  = dbf.newDocumentBuilder();
  -      doc = db.newDocument();
  -    }
  -    catch( Exception e ) {
  -      e.printStackTrace();
  -    }
   
       Element  root = doc.createElement( "handler" );
       root.setAttribute( "class", this.getClass().getName() );
  
  
  
  1.10      +1 -1      xml-axis/java/src/org/apache/axis/Handler.java
  
  Index: Handler.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/Handler.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Handler.java	2001/03/30 17:48:34	1.9
  +++ Handler.java	2001/03/31 00:53:08	1.10
  @@ -128,5 +128,5 @@
      * this is just the data that's stored in the registry.  Used by the
      * 'list' Admin function.
      */
  -  public Element getDeploymentData();
  +  public Element getDeploymentData(Document doc);
   };
  
  
  
  1.16      +7 -29     xml-axis/java/src/org/apache/axis/Message.java
  
  Index: Message.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/Message.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Message.java	2001/03/30 17:48:35	1.15
  +++ Message.java	2001/03/31 00:53:08	1.16
  @@ -60,11 +60,10 @@
   import javax.servlet.http.* ;
   
   import org.w3c.dom.* ;
  -import javax.xml.parsers.* ;
  -import org.apache.xml.serialize.* ;
   
   import org.apache.axis.message.* ;
   import org.apache.axis.utils.Debug ;
  +import org.apache.axis.utils.XMLUtils ;
   
   /**
    *
  @@ -203,18 +202,9 @@
         getAsDocument();
   
       if ( currentForm.equals("Document") ) { 
  -      try {
  -        ByteArrayOutputStream  baos = new ByteArrayOutputStream();
  -        XMLSerializer  xs = new XMLSerializer( baos, new OutputFormat() );
  -        xs.serialize( (Document) currentMessage );
  -        baos.close();
  -        currentForm = "String" ;
  -        currentMessage = baos.toString();
  -        return( (String) currentMessage );
  -      }
  -      catch( Exception e ) {
  -        e.printStackTrace( System.err );
  -      }
  +      currentForm = "String" ;
  +      currentMessage = XMLUtils.DocumentToString( (Document) currentMessage );
  +      return( (String) currentMessage );
       }
   
       System.err.println("Can't convert " + currentForm + " to String" );
  @@ -226,18 +216,6 @@
       Debug.Print( 2, "Enter: Message::getAsDocument" );
       if ( currentForm.equals("Document") ) return( (Document) currentMessage );
   
  -    DocumentBuilderFactory dbf = null ;
  -    DocumentBuilder        db  = null ;
  -
  -    try {
  -      dbf = DocumentBuilderFactory.newInstance();
  -      dbf.setNamespaceAware(true);
  -      db  = dbf.newDocumentBuilder();
  -    }
  -    catch( Exception e ) {
  -      e.printStackTrace();
  -    }
  -
       InputStream inp     = null ;
   
       try {
  @@ -260,7 +238,7 @@
           // Reader reader = new StringReader( (String) currentMessage );
           ByteArrayInputStream bais =  null ;
           bais = new ByteArrayInputStream( ((String)currentMessage).getBytes() );
  -        setCurrentMessage( db.parse( bais ), "Document" );
  +        setCurrentMessage( XMLUtils.newDocument( bais ), "Document" );
           Debug.Print( 2, "Exit: Message::getAsDocument" );
           return( (Document) currentMessage );
         }
  @@ -271,7 +249,7 @@
         else if ( currentForm.equals("AxisFault") ) {
           AxisFault     fault = (AxisFault) currentMessage ;
           SOAPEnvelope  env   = new SOAPEnvelope();
  -        SOAPBody      body  = new SOAPBody( fault.getElement() );
  +        SOAPBody      body  = new SOAPBody( fault.getElement(null) );
   
           env.addBody( body );
   
  @@ -291,7 +269,7 @@
           return( null );
         }
     
  -      setCurrentMessage( db.parse( inp ), "Document" );
  +      setCurrentMessage( XMLUtils.newDocument( inp ), "Document" );
         Debug.Print( 2, "Exit: Message::getAsDocument" );
         return( (Document) currentMessage );
       }
  
  
  
  1.12      +2 -16     xml-axis/java/src/org/apache/axis/SimpleChain.java
  
  Index: SimpleChain.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/SimpleChain.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SimpleChain.java	2001/03/30 17:48:35	1.11
  +++ SimpleChain.java	2001/03/31 00:53:08	1.12
  @@ -61,7 +61,6 @@
   import org.apache.axis.handlers.*;
   
   import org.w3c.dom.* ;
  -import javax.xml.parsers.* ;
   
   /**
    *
  @@ -148,21 +147,8 @@
     public Element getDeploymentData() {
       Debug.Print( 1, "Enter: SimpleChain::getDeploymentData" );
   
  -    DocumentBuilderFactory dbf = null ;
  -    DocumentBuilder        db  = null ;
  -    Document               doc = null ;
  -
  -    try {
  -      dbf = DocumentBuilderFactory.newInstance();
  -      dbf.setNamespaceAware(true);
  -      db  = dbf.newDocumentBuilder();
  -      doc = db.newDocument();
  -    }
  -    catch( Exception e ) {
  -      e.printStackTrace();
  -    }
  -
  -    Element root = doc.createElement( "chain" );
  +    Document doc  = XMLUtils.newDocument();
  +    Element  root = doc.createElement( "chain" );
   
       if (handlers != null ) {
         StringBuffer str = new StringBuffer();
  
  
  
  1.12      +2 -16     xml-axis/java/src/org/apache/axis/SimpleTargetedChain.java
  
  Index: SimpleTargetedChain.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/SimpleTargetedChain.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SimpleTargetedChain.java	2001/03/30 17:48:35	1.11
  +++ SimpleTargetedChain.java	2001/03/31 00:53:08	1.12
  @@ -61,7 +61,6 @@
   import org.apache.axis.handlers.* ;
   
   import org.w3c.dom.* ;
  -import javax.xml.parsers.* ;
   
   /**
    *
  @@ -156,21 +155,8 @@
       StringBuffer str  = new StringBuffer();
       Handler      h ;
   
  -    DocumentBuilderFactory dbf = null ;
  -    DocumentBuilder        db  = null ;
  -    Document               doc = null ;
  -
  -    try {
  -      dbf = DocumentBuilderFactory.newInstance();
  -      dbf.setNamespaceAware(true);
  -      db  = dbf.newDocumentBuilder();
  -      doc = db.newDocument();
  -    }
  -    catch( Exception e ) {
  -      e.printStackTrace();
  -    }
  -
  -    Element      root = doc.createElement( "chain" );
  +    Document  doc  = XMLUtils.newDocument();
  +    Element   root = doc.createElement( "chain" );
   
       if ( inputChain != null ) {
         Handler[]  handlers = inputChain.getHandlers();
  
  
  
  1.5       +1 -1      xml-axis/java/src/org/apache/axis/client/AxisClient.java
  
  Index: AxisClient.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/AxisClient.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AxisClient.java	2001/03/22 14:49:03	1.4
  +++ AxisClient.java	2001/03/31 00:53:09	1.5
  @@ -57,7 +57,7 @@
   
   import java.util.* ;
   import org.apache.axis.* ;
  -import org.apache.axis.utils.* ;
  +import org.apache.axis.utils.Debug ;
   import org.apache.axis.handlers.* ;
   import org.apache.axis.registries.* ;
   
  
  
  
  1.25      +8 -17     xml-axis/java/src/org/apache/axis/client/HTTPMessage.java
  
  Index: HTTPMessage.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/HTTPMessage.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- HTTPMessage.java	2001/03/30 19:26:14	1.24
  +++ HTTPMessage.java	2001/03/31 00:53:09	1.25
  @@ -66,11 +66,11 @@
   import org.apache.axis.handlers.* ;
   import org.apache.axis.registries.* ;
   import org.apache.axis.utils.* ;
  +import org.apache.axis.utils.XMLUtils ;
   import org.apache.axis.transport.http.HTTPConstants;
   import org.apache.axis.transport.http.HTTPDispatchHandler;
   
   import org.w3c.dom.* ;
  -import javax.xml.parsers.* ;
   
   /**
    * This class is meant to be the interface that client/requestor code
  @@ -167,21 +167,8 @@
       Message              reqMsg = new Message( reqEnv, "SOAPEnvelope" );
       MessageContext       msgContext = new MessageContext( reqMsg );
   
  -    DocumentBuilderFactory dbf = null ;
  -    DocumentBuilder        db  = null ;
  -    Document               doc = null ;
  +    Document doc = XMLUtils.newDocument();
   
  -    try {
  -      dbf = DocumentBuilderFactory.newInstance();
  -      dbf.setNamespaceAware(true);
  -      db  = dbf.newDocumentBuilder();
  -      doc = db.newDocument();
  -    } 
  -    catch( Exception e ) {
  -      Debug.Print( 1, e );
  -      throw new AxisFault( e );
  -    }
  -
       // For testing - skip HTTP layer
       if ( doLocal ) {
         client = new org.apache.axis.server.AxisServer();
  @@ -247,8 +234,12 @@
       SOAPEnvelope  resEnv = (SOAPEnvelope) resMsg.getAs( "SOAPEnvelope" );
       SOAPBody      resBody = resEnv.getFirstBody();
   
  -    doc = db.newDocument();
  -    doc.appendChild( doc.importNode( resBody.getRoot(), true ) );
  +    doc = XMLUtils.newDocument();
  +    Element  root = resBody.getRoot();
  +    if ( root.getOwnerDocument() != doc )
  +      doc.appendChild( doc.importNode( root, true ) );
  +    else
  +      doc.appendChild( root );
   
       mc.setResponseMessage( new Message(doc, "Document") );
   
  
  
  
  1.6       +2 -16     xml-axis/java/src/org/apache/axis/handlers/BasicHandler.java
  
  Index: BasicHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/BasicHandler.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- BasicHandler.java	2001/03/30 17:48:41	1.5
  +++ BasicHandler.java	2001/03/31 00:53:09	1.6
  @@ -59,9 +59,9 @@
   import org.apache.axis.*;
   import org.apache.axis.utils.QName;
   import org.apache.axis.utils.Debug;
  +import org.apache.axis.utils.XMLUtils ;
   
   import org.w3c.dom.* ;
  -import javax.xml.parsers.* ;
   
   /** <code>BasicHandler</code> is a utility class which implements simple
    * property setting/getting behavior, and stubs out a lot of the Handler
  @@ -126,22 +126,8 @@
           options = opts ;
       }
   
  -    public Element getDeploymentData() {
  +    public Element getDeploymentData(Document doc) {
         Debug.Print( 1, "Enter: BasicHandler::getDeploymentData" );
  -
  -      DocumentBuilderFactory dbf = null ;
  -      DocumentBuilder        db  = null ;
  -      Document               doc = null ;
  -
  -      try {
  -        dbf = DocumentBuilderFactory.newInstance();
  -        dbf.setNamespaceAware(true);
  -        db  = dbf.newDocumentBuilder();
  -        doc = db.newDocument();
  -      }
  -      catch( Exception e ) {
  -        e.printStackTrace();
  -      }
   
         Element  root = doc.createElement( "handler" );
   
  
  
  
  1.5       +8 -16     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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JWSProcessor.java	2001/03/30 17:48:41	1.4
  +++ JWSProcessor.java	2001/03/31 00:53:09	1.5
  @@ -59,10 +59,10 @@
   import org.apache.axis.* ;
   import org.apache.axis.utils.Debug ;
   import org.apache.axis.utils.AxisClassLoader ;
  +import org.apache.axis.utils.XMLUtils ;
   import sun.tools.javac.Main;
   
   import org.w3c.dom.* ;
  -import javax.xml.parsers.* ;
   
   /**
    * This handler will use the JWSFileName property of the MsgContext to
  @@ -122,7 +122,12 @@
           FileOutputStream  out      = new FileOutputStream( errFile );
           Main              compiler = new Main( out, "javac" );
           String            outdir   = f1.getParent();
  -        String[]          args     = new String[] { "-d", outdir, jFile };
  +        String[]          args     = null ;
  +        
  +        args = new String[] { "-d", outdir, 
  +                              "-classpath",
  +                                System.getProperty("java.class.path" ),
  +                              jFile };
           boolean           result   = compiler.compile( args );
   
           /* Delete the temporary *.java file and check the return code */
  @@ -137,20 +142,7 @@
             /***********************************************************/
             (new File(cFile)).delete();
   
  -          DocumentBuilderFactory dbf = null ;
  -          DocumentBuilder        db  = null ;
  -          Document               doc = null ;
  -          
  -          try {
  -            dbf = DocumentBuilderFactory.newInstance();
  -            dbf.setNamespaceAware(true);
  -            db  = dbf.newDocumentBuilder();
  -            doc = db.newDocument();
  -          }
  -          catch( Exception e ) {
  -            Debug.Print( 1, e );
  -            throw new AxisFault( e );
  -          }
  +          Document doc = XMLUtils.newDocument();
   
             Element         root = doc.createElement( "Errors" );
             StringBuffer    sbuf = new StringBuffer();
  
  
  
  1.15      +1 -16     xml-axis/java/src/org/apache/axis/handlers/MsgDispatchHandler.java
  
  Index: MsgDispatchHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/MsgDispatchHandler.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- MsgDispatchHandler.java	2001/03/30 17:48:42	1.14
  +++ MsgDispatchHandler.java	2001/03/31 00:53:09	1.15
  @@ -68,7 +68,6 @@
   import org.apache.axis.handlers.* ;
   
   import org.w3c.dom.* ;
  -import javax.xml.parsers.* ;
   
   /**
    *
  @@ -110,21 +109,7 @@
                                 new SOAPEnvelope() :
                                 (SOAPEnvelope)resMsg.getAs("SOAPEnvelope");
   
  -      DocumentBuilderFactory dbf = null ;
  -      DocumentBuilder        db  = null ;
  -      Document               doc = null ;
  -
  -      try {
  -        dbf = DocumentBuilderFactory.newInstance();
  -        dbf.setNamespaceAware(true);
  -        db  = dbf.newDocumentBuilder();
  -        doc = db.newDocument();
  -      }
  -      catch( Exception e ) {
  -        Debug.Print( 1, e );
  -        throw new AxisFault( e );
  -      }
  -
  +      Document doc = XMLUtils.newDocument();
         doc.appendChild( doc.importNode(reqBody.getRoot(),true) );
   
         /* If no methodName was specified during deployment then get it */
  
  
  
  1.12      +1 -16     xml-axis/java/src/org/apache/axis/message/RPCArg.java
  
  Index: RPCArg.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/RPCArg.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- RPCArg.java	2001/03/30 17:48:45	1.11
  +++ RPCArg.java	2001/03/31 00:53:10	1.12
  @@ -62,7 +62,6 @@
   import org.apache.axis.utils.AxisClassLoader ;
   import org.apache.axis.utils.Debug ;
   
  -import javax.xml.parsers.* ;
   import org.w3c.dom.* ;
   
   /**
  @@ -125,22 +124,8 @@
     }
     public void   setType(String str) { type = str ; }
   
  -  public Element getElement() {
  +  public Element getElement(Document doc) {
       Element   root ;
  -
  -    DocumentBuilderFactory dbf = null ;
  -    DocumentBuilder        db  = null ;
  -    Document               doc = null ;
  -
  -    try {
  -      dbf = DocumentBuilderFactory.newInstance();
  -      dbf.setNamespaceAware(true);
  -      db  = dbf.newDocumentBuilder();
  -      doc = db.newDocument();
  -    }
  -    catch( Exception e ) {
  -      e.printStackTrace();
  -    }
   
       if ( prefix != null ) {
         root = doc.createElementNS( namespaceURI, prefix + ":" + name );
  
  
  
  1.14      +6 -19     xml-axis/java/src/org/apache/axis/message/RPCBody.java
  
  Index: RPCBody.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/RPCBody.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- RPCBody.java	2001/03/30 17:48:45	1.13
  +++ RPCBody.java	2001/03/31 00:53:10	1.14
  @@ -58,10 +58,10 @@
   // !!!!***** Just a placeholder until we get the real stuff ***!!!!!
   
   import java.util.* ;
  +import org.apache.axis.utils.XMLUtils ;
   import org.apache.axis.message.* ;
   
   import org.w3c.dom.* ;
  -import javax.xml.parsers.* ;
   
   /**
    *
  @@ -137,23 +137,10 @@
       }
     }
   
  -  public Element getElement() {
  +  public Element getElement(Document doc) {
       Element   root ;
  -
  -    DocumentBuilderFactory dbf = null ;
  -    DocumentBuilder        db  = null ;
  -    Document               doc = null ;
  -
  -    try {
  -      dbf = DocumentBuilderFactory.newInstance();
  -      dbf.setNamespaceAware(true);
  -      db  = dbf.newDocumentBuilder();
  -      doc = db.newDocument();
  -    }
  -    catch( Exception e ) {
  -      e.printStackTrace();
  -    }
  -   
  +  
  +    if ( doc == null ) doc = XMLUtils.newDocument();
       if ( prefix != null )  {
         root = doc.createElementNS( namespaceURI, prefix + ":" + methodName );
         root.setAttribute( "xmlns:" + prefix, namespaceURI );
  @@ -162,13 +149,13 @@
         root = doc.createElement( methodName );
       for ( int i = 0 ; args != null && i < args.size() ; i++ ) {
         RPCArg  arg = (RPCArg) args.get(i) ;
  -      root.appendChild( doc.importNode(arg.getElement(),true) );
  +      root.appendChild( arg.getElement(doc) );
       }
       return( root );
     }
   
     public SOAPBody getAsSOAPBody() {
  -    return( new SOAPBody( getElement() ) );
  +    return( new SOAPBody( getElement(null) ) );
     }
   
   };
  
  
  
  1.16      +5 -19     xml-axis/java/src/org/apache/axis/message/SOAPEnvelope.java
  
  Index: SOAPEnvelope.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPEnvelope.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- SOAPEnvelope.java	2001/03/30 17:48:46	1.15
  +++ SOAPEnvelope.java	2001/03/31 00:53:10	1.16
  @@ -58,11 +58,11 @@
   package org.apache.axis.message ;
   
   import java.util.* ;
  -import org.apache.axis.message.* ;
   import org.apache.axis.* ;
  +import org.apache.axis.utils.* ;
  +import org.apache.axis.message.* ;
   
   import org.w3c.dom.* ;
  -import javax.xml.parsers.* ;
   
   /**
    *
  @@ -233,19 +233,7 @@
       String tmpEnc    = (encodingStyleURI != null ? encodingStyleURI :
                                                      Constants.URI_SOAP_ENC );
   
  -    DocumentBuilderFactory dbf = null ;
  -    DocumentBuilder        db  = null ;
  -    Document               doc = null ;
  -
  -    try {
  -      dbf = DocumentBuilderFactory.newInstance();
  -      dbf.setNamespaceAware(true);
  -      db  = dbf.newDocumentBuilder();
  -      doc = db.newDocument();
  -    }
  -    catch( Exception e ) {
  -      e.printStackTrace();
  -    }
  +    Document doc = XMLUtils.newDocument();
   
       root = doc.createElementNS(tmpEnvURI,tmpEnvPre+":"+Constants.ELEM_ENVELOPE);
       root.setAttribute( "xmlns:" + Constants.NSPREFIX_SOAP_ENV,
  @@ -261,7 +249,7 @@
         root.appendChild( elem );
         for ( i = 0 ; i < headers.size() ; i++ ) {
           SOAPHeader h = (SOAPHeader) headers.get(i);
  -        elem.appendChild( doc.importNode( h.getRoot(), true ) );
  +        elem.appendChild( doc.importNode(h.getRoot(),true) );
         }
       } 
       if ( body != null ) {
  @@ -270,9 +258,7 @@
         root.appendChild( elem );
         for ( i = 0 ; i < body.size() ; i++ ) {
           Element  bod = ((SOAPBody)body.get(i)).getRoot();
  -        if ( bod.getOwnerDocument() != null )
  -          bod = (Element) doc.importNode( bod, true );
  -        elem.appendChild( bod );
  +        elem.appendChild( doc.importNode(bod,true) );
         }
       }
       return( doc );
  
  
  
  1.3       +2 -7      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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultHandlerRegistry.java	2001/03/30 17:48:48	1.2
  +++ DefaultHandlerRegistry.java	2001/03/31 00:53:10	1.3
  @@ -61,11 +61,11 @@
   import org.apache.axis.* ;
   import org.apache.axis.utils.Debug ;
   import org.apache.axis.utils.Admin ;
  +import org.apache.axis.utils.XMLUtils ;
   import org.apache.axis.suppliers.* ;
   import org.apache.axis.registries.* ;
   
   import org.w3c.dom.* ;
  -import javax.xml.parsers.* ;
   
   /** 
    *
  @@ -158,12 +158,7 @@
                                                     clientXML).getBytes() );
   
       try {
  -      DocumentBuilderFactory  dbf = DocumentBuilderFactory.newInstance();
  -      dbf.setNamespaceAware(true);
  -      DocumentBuilder         db  = dbf.newDocumentBuilder();
  -      Document                doc = null ;
  -
  -      doc = db.parse( input );
  +      Document doc = XMLUtils.newDocument( input );
         admin.AdminService( msgContext, doc );
       }
       catch( Exception e ) {
  
  
  
  1.3       +2 -7      xml-axis/java/src/org/apache/axis/registries/DefaultServiceRegistry.java
  
  Index: DefaultServiceRegistry.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/registries/DefaultServiceRegistry.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultServiceRegistry.java	2001/03/30 17:48:48	1.2
  +++ DefaultServiceRegistry.java	2001/03/31 00:53:10	1.3
  @@ -61,11 +61,11 @@
   import org.apache.axis.* ;
   import org.apache.axis.utils.Debug ;
   import org.apache.axis.utils.Admin ;
  +import org.apache.axis.utils.XMLUtils ;
   import org.apache.axis.suppliers.* ;
   import org.apache.axis.registries.* ;
   
   import org.w3c.dom.* ;
  -import javax.xml.parsers.* ;
   
   /** 
    *
  @@ -134,12 +134,7 @@
                                                     clientXML).getBytes() );
   
       try {
  -      DocumentBuilderFactory  dbf = DocumentBuilderFactory.newInstance();
  -      dbf.setNamespaceAware(true);
  -      DocumentBuilder         db  = dbf.newDocumentBuilder();
  -      Document                doc = null ;
  -
  -      doc = db.parse( input );
  +      Document doc = XMLUtils.newDocument( input );
         admin.AdminService( msgContext, doc );
       }
       catch( Exception e ) {
  
  
  
  1.12      +2 -22     xml-axis/java/src/org/apache/axis/transport/http/HTTPDispatchHandler.java
  
  Index: HTTPDispatchHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/http/HTTPDispatchHandler.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- HTTPDispatchHandler.java	2001/03/30 17:48:50	1.11
  +++ HTTPDispatchHandler.java	2001/03/31 00:53:10	1.12
  @@ -71,9 +71,6 @@
   import org.apache.axis.encoding.Base64 ;
   
   import org.w3c.dom.* ;
  -import javax.xml.parsers.* ;
  -import org.apache.xml.serialize.XMLSerializer ;
  -import org.apache.xml.serialize.OutputFormat ;
   
   /**
    * This is meant to be used on a SOAP Client to call a SOAP server.
  @@ -222,30 +219,13 @@
         }
   
         if ( b != -1 ) {
  -        DocumentBuilderFactory dbf = null ;
  -        DocumentBuilder        db  = null ;
  -        Document               doc = null ;
  -
  -        try {
  -          dbf = DocumentBuilderFactory.newInstance();
  -          dbf.setNamespaceAware(true);
  -          db  = dbf.newDocumentBuilder();
  -          doc = db.parse( inp );
  -        }
  -        catch( Exception e ) {
  -          e.printStackTrace();
  -        }
  -
  +        Document doc = XMLUtils.newDocument( inp );
           outMsg = new Message( doc, "Document" );
           msgContext.setResponseMessage( outMsg );
   
           Debug.Print( 1, "\nXML received:" );
           Debug.Print( 1, "---------------------------------------------------");
  -        ByteArrayOutputStream  baos = new ByteArrayOutputStream();
  -        XMLSerializer  xs = new XMLSerializer( baos, new OutputFormat() );
  -        xs.serialize( (Document) doc );
  -        baos.close();
  -        Debug.Print( 1, baos.toString() );
  +        Debug.Print( 1, XMLUtils.DocumentToString( doc ) );
         }
         inp.close();
         out.close();
  
  
  
  1.24      +4 -24     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.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- Admin.java	2001/03/30 19:26:15	1.23
  +++ Admin.java	2001/03/31 00:53:11	1.24
  @@ -64,7 +64,6 @@
   import org.apache.axis.suppliers.*;
   
   import org.w3c.dom.* ;
  -import javax.xml.parsers.* ;
   
   /**
    *
  @@ -136,12 +135,7 @@
           Handler    h ;
           int        i, j ;
   
  -        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  -        dbf.setNamespaceAware(true);
  -        DocumentBuilder        db  = dbf.newDocumentBuilder();
  -
  -        doc = db.newDocument();
  -
  +        doc = XMLUtils.newDocument();
           root = doc.createElement( "Admin" );
           doc.appendChild( root );
   
  @@ -158,7 +152,7 @@
   
             for( i = 0 ; i < names.length ; i++ ) {
               h = hr.find(names[i]);
  -            elem = h.getDeploymentData();
  +            elem = h.getDeploymentData(doc);
   
               if ( elem == null ) continue ;
   
  @@ -371,13 +365,7 @@
                                  "Unknown type to " + action + ": " + type,
                                  null, null );
         }
  -
  -      DocumentBuilderFactory  dbf = DocumentBuilderFactory.newInstance();
  -      dbf.setNamespaceAware(true);
  -      DocumentBuilder         db  = dbf.newDocumentBuilder();
  -
  -      doc = db.newDocument();
  -
  +      doc = XMLUtils.newDocument();
         doc.appendChild( root = doc.createElement( "Admin" ) );
         root.appendChild( doc.createTextNode( "Done processing" ) );
       }
  @@ -416,16 +404,8 @@
   
       try {
         for ( i = 0 ; i < args.length ; i++ ) {
  -        Document         doc     = null ;
  -
           System.out.println( "Processing '" + args[i] + "'" );
  - 
  -        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  -        dbf.setNamespaceAware(true);
  -        DocumentBuilder        db  = dbf.newDocumentBuilder();
  -        doc = db.parse( new FileInputStream( args[i] ) );
  -
  -        admin.process( doc );
  +        admin.process(XMLUtils.newDocument( new FileInputStream( args[i] ) ));
         }
       }
       catch( AxisFault e ) {
  
  
  
  1.1                  xml-axis/java/webapps/axis/StockQuoteService.jws
  
  Index: StockQuoteService.jws
  ===================================================================
  /*
   * 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/>.
   */
  
  import java.io.*;
  import java.util.* ;
  import java.net.URL;
  
  import org.w3c.dom.* ;
  import org.apache.axis.utils.XMLUtils ;
  
  /**
   * See \samples\stock\readme for info.
   *
   * @author Sanjiva Weerawarana (sanjiva@watson.ibm.com)
   * @author Doug Davis (dug@us.ibm.com)
   */
  public class StockQuoteService {
    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) 66.25 );
  
  
      Document doc = null ;
      
      doc = XMLUtils.newDocument( "http://www.xmltoday.com/examples/" +
                                  "stockquote/getxmlquote.vep?s="+symbol );
  
      Element  elem = doc.getDocumentElement();
      NodeList list = elem.getElementsByTagName("stock_quote");
  
      elem = (Element) list.item(0);
      list = elem.getElementsByTagName( "price" );
      elem = (Element) list.item( 0 );
      String quoteStr = elem.getAttribute("value");
      try {
        return Float.valueOf(quoteStr).floatValue();
      } catch (NumberFormatException e1) {
        // maybe its an int?
        try {
          return Integer.valueOf(quoteStr).intValue() * 1.0F;
        } catch (NumberFormatException e2) {
          return -1.0F;
        }
      }
    }
  }