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/30 19:48:53 UTC
cvs commit: xml-axis/java/src/org/apache/axis/utils Admin.java LockableHashtable.java
dug 01/03/30 09:48:53
Modified: java build.xml
java/samples/stock ComInfoService.java
StockQuoteService.java
java/src/org/apache/axis AxisFault.java
FaultableHandler.java Handler.java Message.java
SimpleChain.java SimpleTargetedChain.java
java/src/org/apache/axis/client AdminClient.java
HTTPCall.java HTTPMessage.java
java/src/org/apache/axis/handlers BasicHandler.java
DebugHandler.java JWSProcessor.java
MsgDispatchHandler.java RPCDispatchHandler.java
java/src/org/apache/axis/message RPCArg.java RPCBody.java
SOAPBody.java SOAPEnvelope.java SOAPHeader.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
LockableHashtable.java
Log:
JDOM->JAXP
Still needs some work but I wanted to get the 1st pass in there.
Revision Changes Path
1.10 +1 -1 xml-axis/java/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/xml-axis/java/build.xml,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- build.xml 2001/03/06 11:37:09 1.9
+++ build.xml 2001/03/30 17:48:30 1.10
@@ -55,7 +55,7 @@
<property name="year" value="2001"/>
<property name="build.compiler" value="classic"/>
- <property name="debug" value="off"/>
+ <property name="debug" value="on"/>
<property name="src.dir" value="./src"/>
<property name="docs.dir" value="./docs"/>
1.5 +0 -2 xml-axis/java/samples/stock/ComInfoService.java
Index: ComInfoService.java
===================================================================
RCS file: /home/cvs/xml-axis/java/samples/stock/ComInfoService.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ComInfoService.java 2001/03/02 20:02:18 1.4
+++ ComInfoService.java 2001/03/30 17:48:31 1.5
@@ -58,8 +58,6 @@
import java.io.*;
import java.net.URL;
-import org.jdom.* ;
-
/**
*
* @author Doug Davis (dug@us.ibm.com)
1.8 +22 -19 xml-axis/java/samples/stock/StockQuoteService.java
Index: StockQuoteService.java
===================================================================
RCS file: /home/cvs/xml-axis/java/samples/stock/StockQuoteService.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- StockQuoteService.java 2001/03/03 01:07:04 1.7
+++ StockQuoteService.java 2001/03/30 17:48:32 1.8
@@ -59,9 +59,8 @@
import java.util.* ;
import java.net.URL;
-import org.jdom.* ;
-import org.jdom.input.SAXBuilder ;
-import org.jdom.output.XMLOutputter ;
+import javax.xml.parsers.* ;
+import org.w3c.dom.* ;
/**
* See \samples\stock\readme for info.
@@ -80,25 +79,29 @@
URL url = new URL( "http://www.xmltoday.com/examples/" +
"stockquote/getxmlquote.vep?s="+symbol );
- SAXBuilder parser = new SAXBuilder();
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
- Document doc = parser.build( url );
- Element elem = doc.getRootElement();
- elem = elem.getChild( "stock_quote" );
-
- List list = elem.getChildren( "price" );
-
- elem = (Element) list.get( 0 );
- String quoteStr = elem.getAttributeValue("value");
- try {
- return Float.valueOf(quoteStr).floatValue();
- } catch (NumberFormatException e1) {
- // maybe its an int?
+ Document doc = db.parse( url.toExternalForm() );
+ Element elem = doc.getDocumentElement();
+ NodeList list = elem.getElementsByTagName( "stock_quote" );
+
+ if ( list != null && list.getLength() != 0 ) {
+ elem = (Element) list.item(0);
+ list = elem.getElementsByTagName( "price" );
+ elem = (Element) list.item(0);
+ String quoteStr = elem.getAttribute("value");
try {
- return Integer.valueOf(quoteStr).intValue() * 1.0F;
- } catch (NumberFormatException e2) {
- return -1.0F;
+ 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;
+ }
}
}
+ return( 0 );
}
}
1.14 +36 -29 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.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- AxisFault.java 2001/03/29 22:49:46 1.13
+++ AxisFault.java 2001/03/30 17:48:34 1.14
@@ -57,30 +57,24 @@
import java.io.* ;
import java.util.* ;
-import org.jdom.* ;
+
+import javax.xml.parsers.* ;
+import org.w3c.dom.* ;
+
import org.apache.axis.utils.* ;
/**
*
- * @author Doug Davis (dug@us.ibm.com)
- * @author James Snell (jasnell@us.ibm.com)
+ * @author Doug Davis (dug@us.ibm.com.com)
*/
public class AxisFault extends Exception {
- protected QFault faultCode ;
+ protected String faultCode ;
protected String faultString ;
protected String faultActor ;
protected Vector faultDetails ; // vector of Element's
-
public AxisFault(String code, String str, String actor, Element[] details) {
- setFaultCode( new QFault(Constants.AXIS_NS, code));
- setFaultString( str );
- setFaultActor( actor );
- setFaultDetails( details );
- }
-
- public AxisFault(QFault code, String str, String actor, Element[] details) {
setFaultCode( code );
setFaultString( str );
setFaultActor( actor );
@@ -90,7 +84,7 @@
public AxisFault(Exception e) {
String str ;
- setFaultCode( Constants.FAULT_SERVER_GENERAL );
+ setFaultCode( "Server.generalException" );
// setFaultString( e.toString() );
// need to set details if we were in the body at the time!!
ByteArrayOutputStream stream = new ByteArrayOutputStream();
@@ -108,15 +102,11 @@
" faultDetails: " + faultDetails + "\n" );
}
- public void setFaultCode(QFault code) {
- faultCode = code ;
- }
-
public void setFaultCode(String code) {
- faultCode = new QFault(Constants.AXIS_NS, code);
+ faultCode = code ;
}
- public QFault getFaultCode() {
+ public String getFaultCode() {
return( faultCode );
}
@@ -147,23 +137,40 @@
Element elem, root ;
int i ;
- root = new Element( Constants.ELEM_FAULT, Constants.NSPREFIX_SOAP_ENV,
- Constants.URI_SOAP_ENV );
- root.addContent( elem = new Element( Constants.ELEM_FAULT_CODE ) );
- elem.addContent( faultCode.getLocalPart() );
+ 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();
+ }
+
+ root = doc.createElementNS( Constants.URI_SOAP_ENV,
+ Constants.NSPREFIX_SOAP_ENV + ":" +
+ Constants.ELEM_FAULT );
+
+ root.appendChild( elem = doc.createElement( Constants.ELEM_FAULT_CODE ) );
+ elem.appendChild( doc.createTextNode( faultCode ) );
- root.addContent( elem = new Element(Constants.ELEM_FAULT_STRING) );
- elem.addContent( faultString );
+ root.appendChild( elem = doc.createElement( Constants.ELEM_FAULT_STRING ) );
+ elem.appendChild( doc.createTextNode( faultString ) );
if ( faultActor != null && !faultActor.equals("") ) {
- root.addContent( elem = new Element(Constants.ELEM_FAULT_ACTOR) );
- elem.addContent( faultActor );
+ root.appendChild(elem = doc.createElement( Constants.ELEM_FAULT_ACTOR ));
+ elem.appendChild( doc.createTextNode( faultActor ) );
}
if ( faultDetails != null && faultDetails.size() > 0 ) {
- root.addContent( elem = new Element(Constants.ELEM_FAULT_DETAIL) );
+ root.appendChild(elem = doc.createElement( Constants.ELEM_FAULT_DETAIL));
+
for ( i = 0 ;i < faultDetails.size() ; i++ )
- elem.addContent( (Element) faultDetails.get(i) );
+ elem.appendChild( (Element) faultDetails.get(i) );
}
return( root );
1.11 +24 -7 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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- FaultableHandler.java 2001/03/09 19:25:04 1.10
+++ FaultableHandler.java 2001/03/30 17:48:34 1.11
@@ -59,8 +59,10 @@
import java.io.Serializable ;
import org.apache.axis.* ;
import org.apache.axis.utils.* ;
-import org.jdom.Element ;
+import javax.xml.parsers.* ;
+import org.w3c.dom.* ;
+
/**
*
* @author Doug Davis (dug@us.ibm.com)
@@ -146,19 +148,34 @@
public Element getDeploymentData() {
Debug.Print( 1, "Enter: FaultableHandler::getDeploymentData" );
- Element root = new Element( "handler" );
+
+ 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() );
- root.addAttribute( "class", this.getClass().getName() );
options = this.getOptions();
if ( options != null ) {
Enumeration e = options.keys();
while ( e.hasMoreElements() ) {
String k = (String) e.nextElement();
Object v = options.get(k);
- Element e1 = new Element( "option" );
- e1.addAttribute( "name", k );
- e1.addAttribute( "value", v.toString() );
- root.addContent( e1 );
+ Element e1 = doc.createElement( "option" );
+ e1.setAttribute( "name", k );
+ e1.setAttribute( "value", v.toString() );
+ root.appendChild( e1 );
}
}
Debug.Print( 1, "Exit: FaultableHandler::getDeploymentData" );
1.9 +2 -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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Handler.java 2001/03/09 19:25:05 1.8
+++ Handler.java 2001/03/30 17:48:34 1.9
@@ -59,7 +59,8 @@
import java.io.Serializable ;
import org.apache.axis.* ;
import org.apache.axis.utils.* ;
-import org.jdom.Element ;
+
+import org.w3c.dom.* ;
/**
*
1.15 +24 -9 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.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- Message.java 2001/03/21 01:17:08 1.14
+++ Message.java 2001/03/30 17:48:35 1.15
@@ -59,9 +59,9 @@
import javax.servlet.* ;
import javax.servlet.http.* ;
-import org.jdom.* ;
-import org.jdom.input.SAXBuilder ;
-import org.jdom.output.XMLOutputter ;
+import org.w3c.dom.* ;
+import javax.xml.parsers.* ;
+import org.apache.xml.serialize.* ;
import org.apache.axis.message.* ;
import org.apache.axis.utils.Debug ;
@@ -205,9 +205,11 @@
if ( currentForm.equals("Document") ) {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- XMLOutputter xo = new XMLOutputter();
+ XMLSerializer xs = new XMLSerializer( baos, new OutputFormat() );
+ xs.serialize( (Document) currentMessage );
+ baos.close();
currentForm = "String" ;
- currentMessage = xo.outputString( (Document) currentMessage );
+ currentMessage = baos.toString();
return( (String) currentMessage );
}
catch( Exception e ) {
@@ -224,7 +226,18 @@
Debug.Print( 2, "Enter: Message::getAsDocument" );
if ( currentForm.equals("Document") ) return( (Document) currentMessage );
- SAXBuilder parser = new SAXBuilder();
+ 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 {
@@ -244,8 +257,10 @@
// reader = new CharArrayReader(payload);
}
else if ( currentForm.equals("String") ) {
- Reader reader = new StringReader( (String) currentMessage );
- setCurrentMessage( parser.build( reader ), "Document" );
+ // Reader reader = new StringReader( (String) currentMessage );
+ ByteArrayInputStream bais = null ;
+ bais = new ByteArrayInputStream( ((String)currentMessage).getBytes() );
+ setCurrentMessage( db.parse( bais ), "Document" );
Debug.Print( 2, "Exit: Message::getAsDocument" );
return( (Document) currentMessage );
}
@@ -276,7 +291,7 @@
return( null );
}
- setCurrentMessage( parser.build( inp ), "Document" );
+ setCurrentMessage( db.parse( inp ), "Document" );
Debug.Print( 2, "Exit: Message::getAsDocument" );
return( (Document) currentMessage );
}
1.11 +24 -7 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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- SimpleChain.java 2001/03/25 08:49:05 1.10
+++ SimpleChain.java 2001/03/30 17:48:35 1.11
@@ -59,8 +59,10 @@
import org.apache.axis.* ;
import org.apache.axis.utils.* ;
import org.apache.axis.handlers.*;
-import org.jdom.Element ;
+import org.w3c.dom.* ;
+import javax.xml.parsers.* ;
+
/**
*
* @author Doug Davis (dug@us.ibm.com)
@@ -145,7 +147,22 @@
public Element getDeploymentData() {
Debug.Print( 1, "Enter: SimpleChain::getDeploymentData" );
- Element root = new Element( "chain");
+
+ 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" );
if (handlers != null ) {
StringBuffer str = new StringBuffer();
@@ -155,7 +172,7 @@
h = (Handler) handlers.elementAt(i);
str.append( h.getClass().getName() );
}
- root.addAttribute( "flow", str.toString() );
+ root.setAttribute( "flow", str.toString() );
}
options = this.getOptions();
@@ -164,10 +181,10 @@
while ( e.hasMoreElements() ) {
String k = (String) e.nextElement();
Object v = options.get(k);
- Element e1 = new Element( "option" );
- e1.addAttribute( "name", k );
- e1.addAttribute( "value", v.toString() );
- root.addContent( e1 );
+ Element e1 = doc.createElement( "option" );
+ e1.setAttribute( "name", k );
+ e1.setAttribute( "value", v.toString() );
+ root.appendChild( e1 );
}
}
1.11 +26 -9 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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- SimpleTargetedChain.java 2001/03/28 23:01:40 1.10
+++ SimpleTargetedChain.java 2001/03/30 17:48:35 1.11
@@ -56,11 +56,13 @@
package org.apache.axis ;
import java.util.* ;
-import org.jdom.Element ;
import org.apache.axis.* ;
import org.apache.axis.utils.* ;
import org.apache.axis.handlers.* ;
+import org.w3c.dom.* ;
+import javax.xml.parsers.* ;
+
/**
*
* @author Doug Davis (dug@us.ibm.com)
@@ -152,9 +154,24 @@
public Element getDeploymentData() {
Debug.Print( 1, "Enter: SimpleTargetedChain::getDeploymentData" );
StringBuffer str = new StringBuffer();
- Element root = new Element( "chain");
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" );
+
if ( inputChain != null ) {
Handler[] handlers = inputChain.getHandlers();
str = new StringBuffer();
@@ -163,10 +180,10 @@
if ( i != 0 ) str.append(",");
str.append( h.getClass().getName() );
}
- root.addAttribute( "input", str.toString() );
+ root.setAttribute( "input", str.toString() );
}
if ( pivotHandler != null ) {
- root.addAttribute( "pivot", pivotHandler.getClass().getName() );
+ root.setAttribute( "pivot", pivotHandler.getClass().getName() );
}
if ( outputChain != null ) {
Handler[] handlers = inputChain.getHandlers();
@@ -176,7 +193,7 @@
if ( i != 0 ) str.append(",");
str.append( h.getClass().getName() );
}
- root.addAttribute( "input", str.toString() );
+ root.setAttribute( "input", str.toString() );
}
options = this.getOptions();
@@ -185,10 +202,10 @@
while ( e.hasMoreElements() ) {
String k = (String) e.nextElement();
Object v = options.get(k);
- Element e1 = new Element( "option" );
- e1.addAttribute( "name", k );
- e1.addAttribute( "value", v.toString() );
- root.addContent( e1 );
+ Element e1 = doc.createElement( "option" );
+ e1.setAttribute( "name", k );
+ e1.setAttribute( "value", v.toString() );
+ root.appendChild( e1 );
}
}
1.13 +1 -9 xml-axis/java/src/org/apache/axis/client/AdminClient.java
Index: AdminClient.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/AdminClient.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- AdminClient.java 2001/03/09 19:25:18 1.12
+++ AdminClient.java 2001/03/30 17:48:38 1.13
@@ -58,8 +58,6 @@
import java.net.*;
import java.io.*;
import java.util.*;
-import org.jdom.output.XMLOutputter ;
-import org.jdom.Document ;
import org.apache.axis.utils.Options ;
import org.apache.axis.Message ;
@@ -114,13 +112,7 @@
outMsg = msgContext.getResponseMessage();
input.close();
- if ( args[i].equals("list") ) {
- XMLOutputter out = new XMLOutputter(" ", true);
- Document doc = (Document) outMsg.getAs("Document");
- out.output(doc, System.out);
- }
- else
- System.err.println( outMsg.getAs( "String" ) );
+ System.err.println( outMsg.getAs( "String" ) );
}
}
catch( Exception e ) {
1.17 +24 -3 xml-axis/java/src/org/apache/axis/client/HTTPCall.java
Index: HTTPCall.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/HTTPCall.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- HTTPCall.java 2001/03/26 21:42:07 1.16
+++ HTTPCall.java 2001/03/30 17:48:39 1.17
@@ -56,8 +56,6 @@
package org.apache.axis.client ;
import java.util.* ;
-import org.jdom.* ;
-import org.apache.axis.* ;
import org.apache.axis.message.RPCArg;
import org.apache.axis.message.RPCBody;
import org.apache.axis.message.SOAPBody;
@@ -69,6 +67,13 @@
import org.apache.axis.transport.http.HTTPConstants;
import org.apache.axis.transport.http.HTTPDispatchHandler;
+import org.w3c.dom.* ;
+
+import java.io.* ;
+import javax.xml.parsers.* ;
+import org.apache.xml.serialize.XMLSerializer ;
+import org.apache.xml.serialize.OutputFormat ;
+
/**
* This class is meant to be the interface that client/requestor code
* uses to access the SOAP server. In this class, we'll use HTTP to
@@ -186,7 +191,23 @@
resMsg = msgContext.getResponseMessage();
Document doc = (Document) resMsg.getAs("Document");
- body = new RPCBody( doc.getRootElement() );
+{
+try {
+ByteArrayOutputStream baos = new ByteArrayOutputStream();
+XMLSerializer xs = new XMLSerializer( baos, new OutputFormat() );
+xs.serialize( (Document) doc );
+baos.close();
+Debug.Print( 1, "AGAIN" );
+Debug.Print( 1, baos.toString() );
+} catch( Exception e ) {}
+
+ Element elem = doc.getDocumentElement();
+ System.err.println("doc: " + doc );
+ System.err.println("elem: " + elem );
+ System.err.println("elem: " + elem.getNodeName() );
+}
+
+ body = new RPCBody( doc.getDocumentElement() );
resArgs = body.getArgs();
if ( resArgs != null && resArgs.size() > 0 )
result = (String) ((RPCArg) resArgs.get(0)).getValue() ;
1.23 +23 -5 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.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- HTTPMessage.java 2001/03/26 21:42:07 1.22
+++ HTTPMessage.java 2001/03/30 17:48:39 1.23
@@ -56,7 +56,6 @@
package org.apache.axis.client ;
import java.util.* ;
-import org.jdom.* ;
import org.apache.axis.* ;
import org.apache.axis.message.RPCArg;
@@ -66,11 +65,13 @@
import org.apache.axis.message.SOAPHeader;
import org.apache.axis.handlers.* ;
import org.apache.axis.registries.* ;
-import org.apache.axis.* ;
import org.apache.axis.utils.* ;
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
* uses to access the SOAP server. In this class, we'll use HTTP to
@@ -166,6 +167,21 @@
Message reqMsg = new Message( reqEnv, "SOAPEnvelope" );
MessageContext msgContext = new MessageContext( reqMsg );
+ 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 );
+ }
+
// For testing - skip HTTP layer
if ( doLocal ) {
client = new org.apache.axis.server.AxisServer();
@@ -201,8 +217,8 @@
}
if ( Debug.getDebugLevel() > 0 ) {
- Element elem = new Element( "Debug", "d", Constants.URI_DEBUG );
- elem.addContent( "" + Debug.getDebugLevel() );
+ Element elem = doc.createElementNS( Constants.URI_DEBUG, "d:Debug" );
+ elem.appendChild( doc.createTextNode( ""+Debug.getDebugLevel() ) );
SOAPHeader header = new SOAPHeader(elem);
header.setActor( Constants.URI_NEXT_ACTOR );
@@ -229,7 +245,9 @@
Message resMsg = msgContext.getResponseMessage();
SOAPEnvelope resEnv = (SOAPEnvelope) resMsg.getAs( "SOAPEnvelope" );
SOAPBody resBody = resEnv.getFirstBody();
- Document doc = new Document( resBody.getRoot() );
+
+ doc = db.newDocument();
+ doc.appendChild( doc.importNode( resBody.getRoot(), true ) );
mc.setResponseMessage( new Message(doc, "Document") );
1.5 +23 -7 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- BasicHandler.java 2001/03/09 19:25:23 1.4
+++ BasicHandler.java 2001/03/30 17:48:41 1.5
@@ -60,7 +60,8 @@
import org.apache.axis.utils.QName;
import org.apache.axis.utils.Debug;
-import org.jdom.Element ;
+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
@@ -127,19 +128,34 @@
public Element getDeploymentData() {
Debug.Print( 1, "Enter: BasicHandler::getDeploymentData" );
- Element root = new Element( "handler" );
- root.addAttribute( "class", this.getClass().getName() );
+ 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() );
options = this.getOptions();
if ( options != null ) {
Enumeration e = options.keys();
while ( e.hasMoreElements() ) {
String k = (String) e.nextElement();
Object v = options.get(k);
- Element e1 = new Element( "option" );
- e1.addAttribute( "name", k );
- e1.addAttribute( "value", v.toString() );
- root.addContent( e1 );
+ Element e1 = doc.createElement( "option" );
+ e1.setAttribute( "name", k );
+ e1.setAttribute( "value", v.toString() );
+ root.appendChild( e1 );
}
}
Debug.Print( 1, "Exit: BasicHandler::getDeploymentData" );
1.9 +3 -2 xml-axis/java/src/org/apache/axis/handlers/DebugHandler.java
Index: DebugHandler.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/DebugHandler.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- DebugHandler.java 2001/03/26 21:42:30 1.8
+++ DebugHandler.java 2001/03/30 17:48:41 1.9
@@ -56,7 +56,6 @@
package org.apache.axis.handlers ;
import java.util.* ;
-import org.jdom.* ;
import org.apache.axis.* ;
import org.apache.axis.utils.* ;
@@ -66,6 +65,8 @@
import org.apache.axis.message.SOAPEnvelope;
import org.apache.axis.message.SOAPHeader;
+import org.w3c.dom.* ;
+
/**
*
* @author Doug Davis (dug@us.ibm.com)
@@ -84,7 +85,7 @@
for ( int i = 0 ; headers != null && i < headers.size() ; i ++ ) {
SOAPHeader header = (SOAPHeader) headers.get(i);
Element root = header.getRoot();
- String value = root.getText();
+ String value = root.getFirstChild().getNodeValue();
if ( value != null ) {
int debugVal = Integer.parseInt( value );
Debug.Print( 1, "Setting debug level to: " + debugVal );
1.4 +21 -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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JWSProcessor.java 2001/03/15 01:53:32 1.3
+++ JWSProcessor.java 2001/03/30 17:48:41 1.4
@@ -60,8 +60,10 @@
import org.apache.axis.utils.Debug ;
import org.apache.axis.utils.AxisClassLoader ;
import sun.tools.javac.Main;
-import org.jdom.* ;
+import org.w3c.dom.* ;
+import javax.xml.parsers.* ;
+
/**
* This handler will use the JWSFileName property of the MsgContext to
* locate a *.jws (JavaWebService) file. If found it will copy it to a
@@ -134,7 +136,23 @@
/* confuse us. */
/***********************************************************/
(new File(cFile)).delete();
- Element root = new Element( "Errors" );
+
+ 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 );
+ }
+
+ Element root = doc.createElement( "Errors" );
StringBuffer sbuf = new StringBuffer();
FileReader inp = new FileReader( errFile );
@@ -143,7 +161,7 @@
while ( (rc = inp.read(buf, 0, 4096)) > 0 )
sbuf.append( buf, 0, rc );
inp.close();
- root.addContent( sbuf.toString() );
+ root.appendChild( doc.createTextNode( sbuf.toString() ) );
(new File(errFile)).delete();
throw new AxisFault( "Server.compileError",
"Error while compiling: " + jFile,
1.14 +22 -5 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.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- MsgDispatchHandler.java 2001/03/26 21:42:30 1.13
+++ MsgDispatchHandler.java 2001/03/30 17:48:42 1.14
@@ -58,7 +58,6 @@
import java.io.* ;
import java.util.* ;
import java.lang.reflect.* ;
-import org.jdom.* ;
import org.apache.axis.* ;
import org.apache.axis.utils.* ;
import org.apache.axis.message.RPCArg;
@@ -68,6 +67,9 @@
import org.apache.axis.message.SOAPHeader;
import org.apache.axis.handlers.* ;
+import org.w3c.dom.* ;
+import javax.xml.parsers.* ;
+
/**
*
* @author Doug Davis (dug@us.ibm.com)
@@ -107,20 +109,35 @@
SOAPEnvelope resEnv = (resMsg == null) ?
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 = new Document( reqBody.getRoot() );
+ doc.appendChild( doc.importNode(reqBody.getRoot(),true) );
/* 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.getRootElement();
- if ( root != null ) methodName = root.getName();
+ Element root = doc.getDocumentElement();
+ if ( root != null ) methodName = root.getLocalName();
}
argClasses[0] = cl.loadClass("org.apache.axis.MessageContext");
- argClasses[1] = cl.loadClass("org.jdom.Document");
+ argClasses[1] = cl.loadClass("org.w3c.dom.Document");
argObjects[0] = msgContext ;
argObjects[1] = doc ;
1.23 +0 -1 xml-axis/java/src/org/apache/axis/handlers/RPCDispatchHandler.java
Index: RPCDispatchHandler.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/RPCDispatchHandler.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- RPCDispatchHandler.java 2001/03/26 21:42:31 1.22
+++ RPCDispatchHandler.java 2001/03/30 17:48:42 1.23
@@ -57,7 +57,6 @@
import java.util.* ;
import java.lang.reflect.* ;
-import org.jdom.* ;
import org.apache.axis.* ;
import org.apache.axis.utils.* ;
import org.apache.axis.message.RPCArg;
1.11 +26 -8 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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- RPCArg.java 2001/03/21 01:17:19 1.10
+++ RPCArg.java 2001/03/30 17:48:45 1.11
@@ -58,11 +58,13 @@
// !!!!***** Just a placeholder until we get the real stuff ***!!!!!
import java.util.* ;
-import org.jdom.* ;
import org.apache.axis.utils.AxisClassLoader ;
import org.apache.axis.utils.Debug ;
+import javax.xml.parsers.* ;
+import org.w3c.dom.* ;
+
/**
*
* @author Doug Davis (dug@us.ibm.com)
@@ -77,10 +79,10 @@
public RPCArg() {}
public RPCArg(Element elem) {
- prefix = elem.getNamespacePrefix();
+ prefix = elem.getPrefix();
namespaceURI = elem.getNamespaceURI();
- name = elem.getName();
- value = elem.getText();
+ name = elem.getLocalName();
+ value = elem.getFirstChild().getNodeValue();
}
public RPCArg(String name) {
@@ -125,12 +127,28 @@
public Element getElement() {
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 = new Element( name, prefix, namespaceURI );
+ if ( prefix != null ) {
+ root = doc.createElementNS( namespaceURI, prefix + ":" + name );
+ root.setAttribute( "xmlns:" + prefix, namespaceURI );
+ }
else
- root = new Element( name );
- root.addContent( value );
+ root = doc.createElement( name );
+ root.appendChild( doc.createTextNode( value ) );
return( root );
}
};
1.13 +30 -11 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.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- RPCBody.java 2001/03/21 01:17:19 1.12
+++ RPCBody.java 2001/03/30 17:48:45 1.13
@@ -58,9 +58,11 @@
// !!!!***** Just a placeholder until we get the real stuff ***!!!!!
import java.util.* ;
-import org.jdom.* ;
import org.apache.axis.message.* ;
+import org.w3c.dom.* ;
+import javax.xml.parsers.* ;
+
/**
*
* @author Doug Davis (dug@us.ibm.com)
@@ -82,10 +84,10 @@
}
public void setBody( Element root ) {
- setMethodName( root.getName() );
- setPrefix( root.getNamespacePrefix() );
+ setMethodName( root.getLocalName() );
+ setPrefix( root.getPrefix() );
setNamespaceURI( root.getNamespaceURI() );
- parseArgs( root.getChildren() );
+ parseArgs( root.getChildNodes() );
}
public RPCBody(String methodName, Object[] args) {
@@ -126,9 +128,10 @@
args.add( arg );
}
- public void parseArgs(List list) {
- for ( int i = 0 ; list != null && i < list.size() ; i++ ) {
- Object n = list.get(i);
+ public void parseArgs(NodeList list) {
+ for ( int i = 0 ; list != null && i < list.getLength() ; i++ ) {
+ Node n = list.item(i);
+ if ( n.getNodeType() != Node.ELEMENT_NODE ) continue ;
if ( args == null ) args = new ArrayList();
args.add( new RPCArg( (Element) n ) );
}
@@ -136,14 +139,30 @@
public Element getElement() {
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 = new Element( methodName, prefix, namespaceURI );
+ if ( prefix != null ) {
+ root = doc.createElementNS( namespaceURI, prefix + ":" + methodName );
+ root.setAttribute( "xmlns:" + prefix, namespaceURI );
+ }
else
- root = new Element( methodName );
+ root = doc.createElement( methodName );
for ( int i = 0 ; args != null && i < args.size() ; i++ ) {
RPCArg arg = (RPCArg) args.get(i) ;
- root.addContent( arg.getElement() );
+ root.appendChild( doc.importNode(arg.getElement(),true) );
}
return( root );
}
1.14 +3 -42 xml-axis/java/src/org/apache/axis/message/SOAPBody.java
Index: SOAPBody.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPBody.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- SOAPBody.java 2001/03/21 13:48:03 1.13
+++ SOAPBody.java 2001/03/30 17:48:45 1.14
@@ -58,10 +58,11 @@
// !!!!***** Just a placeholder until we get the real stuff ***!!!!!
import java.util.* ;
-import org.jdom.* ;
import org.apache.axis.AxisFault ;
import org.apache.axis.message.* ;
+import org.w3c.dom.* ;
+
/**
*
* @author Doug Davis (dug@us.ibm.com)
@@ -75,35 +76,15 @@
public SOAPBody(Document doc) {
if ( doc != null )
- root = doc.getRootElement() ;
+ root = doc.getDocumentElement() ;
else
root = null ;
}
- public SOAPBody(org.w3c.dom.Document doc) {
- if ( doc != null ) {
- org.jdom.input.DOMBuilder builder = null ;
- builder = new org.jdom.input.DOMBuilder();
- root = builder.build( doc ).getRootElement();
- }
- else
- root = null ;
- }
-
public SOAPBody(Element elem) {
root = elem ;
}
- public SOAPBody(org.w3c.dom.Element elem) {
- if ( elem != null ) {
- org.jdom.input.DOMBuilder builder = null ;
- builder = new org.jdom.input.DOMBuilder();
- root = builder.build( elem );
- }
- else
- root = null ;
- }
-
public Element getRoot() {
return( root );
}
@@ -111,24 +92,4 @@
public void setRoot(Element r) {
this.root = r ;
}
-
- public void setRoot(org.w3c.dom.Element elem) {
- if ( elem == null ) return ;
- org.jdom.input.DOMBuilder builder = null ;
- builder = new org.jdom.input.DOMBuilder();
- setRoot( builder.build(elem) );
- }
-
- public org.w3c.dom.Element getAsDOMElement() throws AxisFault {
- if ( root == null ) return( null );
- try {
- org.jdom.output.DOMOutputter outputter = null ;
- outputter = new org.jdom.output.DOMOutputter();
- return( outputter.output( root ) );
- }
- catch( Exception e ) {
- throw new AxisFault( e );
- }
- }
-
};
1.15 +60 -30 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.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- SOAPEnvelope.java 2001/03/21 01:17:20 1.14
+++ SOAPEnvelope.java 2001/03/30 17:48:46 1.15
@@ -58,10 +58,11 @@
package org.apache.axis.message ;
import java.util.* ;
-import org.jdom.* ;
import org.apache.axis.message.* ;
import org.apache.axis.* ;
+import org.w3c.dom.* ;
+import javax.xml.parsers.* ;
/**
*
@@ -86,7 +87,8 @@
}
public SOAPEnvelope(Document doc) {
- setEnvelope( doc.getRootElement() );
+ Element root = doc.getDocumentElement();
+ setEnvelope( root );
}
public SOAPEnvelope(SOAPBody bod) {
@@ -94,8 +96,8 @@
}
public void setEnvelope(Element elem) {
- List list ;
- Element e ;
+ NodeList list ;
+ Element e = null ;
int i ;
if ( elem == null ) {
@@ -105,26 +107,38 @@
return ;
}
- prefix = elem.getNamespacePrefix();
- namespaceURI = elem.getNamespace().getURI();
- encodingStyleURI = elem.getAttributeValue( Constants.ATTR_ENCODING_STYLE );
+ prefix = elem.getPrefix();
+ namespaceURI = Constants.URI_SOAP_ENV ; // elem.getNamespaceURI();
+ encodingStyleURI = elem.getAttribute( Constants.ATTR_ENCODING_STYLE );
+
+ list = elem.getElementsByTagNameNS( Constants.URI_SOAP_ENV,
+ Constants.ELEM_HEADER );
+ if ( list != null && list.getLength() > 0 )
+ e = (Element) list.item(0);
- e = elem.getChild( Constants.ELEM_HEADER, elem.getNamespace() );
if ( e != null ) {
- list = e.getChildren();
- for ( i = 0 ; i < list.size() ; i++ ) {
- Element h = (Element) list.get(i);
+ list = e.getChildNodes();
+ for ( i = 0 ; i < list.getLength() ; i++ ) {
+ Node n = list.item(i);
+ if ( n.getNodeType() != Node.ELEMENT_NODE ) continue ;
+
+ Element h = (Element) n ;
if ( headers == null ) headers = new Vector();
headers.add( new SOAPHeader( h ) );
}
}
+
+ list = elem.getElementsByTagNameNS( Constants.URI_SOAP_ENV,
+ Constants.ELEM_BODY );
+ if ( list != null && list.getLength() > 0 )
+ e = (Element) list.item(0);
- e = elem.getChild( Constants.ELEM_BODY, elem.getNamespace() );
if ( e != null ) {
- list = e.getChildren();
+ list = e.getChildNodes();
if ( list != null ) {
- for ( i = 0 ; i < list.size() ; i++ ) {
- Object n = list.get(i);
+ for ( i = 0 ; i < list.getLength() ; i++ ) {
+ Node n = list.item(i);
+ if ( n.getNodeType() != Node.ELEMENT_NODE ) continue ;
if ( body == null ) body = new Vector();
body.add( new SOAPBody( (Element) n ) );
}
@@ -210,7 +224,6 @@
}
public Document getDocument() {
- Document doc = null ;
Element root ;
int i ;
@@ -219,30 +232,47 @@
Constants.URI_SOAP_ENV);
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();
+ }
- root = new Element( Constants.ELEM_ENVELOPE, tmpEnvPre, tmpEnvURI );
- root.addAttribute( new Attribute( Constants.ATTR_ENCODING_STYLE,
- tmpEnvPre, tmpEnvURI, tmpEnc ) );
- doc = new Document( root );
+ root = doc.createElementNS(tmpEnvURI,tmpEnvPre+":"+Constants.ELEM_ENVELOPE);
+ root.setAttribute( "xmlns:" + Constants.NSPREFIX_SOAP_ENV,
+ Constants.URI_SOAP_ENV );
+
+ root.setAttributeNS( tmpEnvURI, tmpEnvPre+":"+Constants.ATTR_ENCODING_STYLE,
+ tmpEnc );
+ doc.appendChild( root );
if ( headers != null && headers.size() > 0 ) {
- Element elem = new Element( Constants.ELEM_HEADER,
- tmpEnvPre, tmpEnvURI );
- root.addContent( elem );
+ Element elem = doc.createElementNS( tmpEnvURI,
+ tmpEnvPre+":"+Constants.ELEM_HEADER);
+ root.appendChild( elem );
for ( i = 0 ; i < headers.size() ; i++ ) {
SOAPHeader h = (SOAPHeader) headers.get(i);
- elem.addContent( h.getRoot() );
+ elem.appendChild( doc.importNode( h.getRoot(), true ) );
}
}
if ( body != null ) {
- Element elem = new Element( Constants.ELEM_BODY,
- tmpEnvPre, tmpEnvURI );
- root.addContent( elem );
+ Element elem = doc.createElementNS( tmpEnvURI,
+ tmpEnvPre+":"+Constants.ELEM_BODY);
+ root.appendChild( elem );
for ( i = 0 ; i < body.size() ; i++ ) {
Element bod = ((SOAPBody)body.get(i)).getRoot();
- if ( bod.getDocument() != null )
- bod = (Element) bod.clone();
- elem.addContent( bod );
+ if ( bod.getOwnerDocument() != null )
+ bod = (Element) doc.importNode( bod, true );
+ elem.appendChild( bod );
}
}
return( doc );
1.14 +18 -49 xml-axis/java/src/org/apache/axis/message/SOAPHeader.java
Index: SOAPHeader.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPHeader.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- SOAPHeader.java 2001/03/21 12:48:39 1.13
+++ SOAPHeader.java 2001/03/30 17:48:46 1.14
@@ -58,10 +58,12 @@
// !!!!***** Just a placeholder until we get the real stuff ***!!!!!
import java.util.* ;
-import org.jdom.* ;
import org.apache.axis.message.* ;
import org.apache.axis.* ;
+import org.w3c.dom.* ;
+import javax.xml.parsers.* ;
+
/**
*
* @author Doug Davis (dug@us.ibm.com)
@@ -86,15 +88,6 @@
setRoot( elem );
}
- public SOAPHeader(org.w3c.dom.Element elem) {
- if ( elem != null ) {
- org.jdom.input.DOMBuilder builder = null ;
- builder = new org.jdom.input.DOMBuilder();
- processed = false ;
- setRoot( builder.build(elem) );
- }
- }
-
public Element getRoot() {
return( root );
}
@@ -103,20 +96,20 @@
String value ;
root = elem ;
- prefix = elem.getNamespacePrefix();
+ prefix = elem.getPrefix();
namespaceURI = elem.getNamespaceURI();
- name = elem.getName();
+ name = elem.getLocalName();
- value = elem.getAttributeValue( Constants.ATTR_ACTOR,
- elem.getNamespace() );
+ value = elem.getAttributeNS( elem.getNamespaceURI(),
+ Constants.ATTR_ACTOR );
if ( value != null )
actor = value ;
else
// Handle the case where they set Actor before they set the root
if ( value != null ) setActor( value );
- value = elem.getAttributeValue( Constants.ATTR_MUST_UNDERSTAND,
- elem.getNamespace() );
+ value = elem.getAttributeNS( elem.getNamespaceURI(),
+ Constants.ATTR_MUST_UNDERSTAND );
if ( value != null )
mustUnderstand = "1".equals(value);
else
@@ -124,52 +117,28 @@
if ( mustUnderstand ) setMustUnderstand( true );
}
- public void setRoot(org.w3c.dom.Element elem) {
- if ( elem == null ) return ;
- org.jdom.input.DOMBuilder builder = null ;
- builder = new org.jdom.input.DOMBuilder();
- setRoot( builder.build(elem) );
- }
-
public String getName() { return( name ); }
public String getPrefix() { return( prefix ); }
public String getNamespaceURI() { return( namespaceURI ); }
public boolean getMustUnderstand() { return( mustUnderstand ); }
public void setMustUnderstand(boolean b) {
- Namespace ns = null ;
- Attribute attr = null ;
-
mustUnderstand = b ;
if ( root == null ) return ;
- ns = Namespace.getNamespace( Constants.NSPREFIX_SOAP_ENV,
- Constants.URI_SOAP_ENV );
- attr = new Attribute(Constants.ATTR_MUST_UNDERSTAND, "1", ns );
- root.addAttribute( attr );
+ root.setAttributeNS( Constants.URI_SOAP_ENV,
+ Constants.NSPREFIX_SOAP_ENV + ":" +
+ Constants.ATTR_MUST_UNDERSTAND,
+ "1" );
+
}
public String getActor() { return( actor ); }
public void setActor(String a) {
- Namespace ns = null ;
- Attribute attr = null ;
-
actor = a ;
- ns = Namespace.getNamespace( Constants.NSPREFIX_SOAP_ENV,
- Constants.URI_SOAP_ENV );
- attr = new Attribute( Constants.ATTR_ACTOR, actor, ns );
- root.addAttribute( attr );
- }
-
- public org.w3c.dom.Element getAsDOMElement() throws AxisFault {
- if ( root == null ) return( null );
- try {
- org.jdom.output.DOMOutputter outputter = null ;
- outputter = new org.jdom.output.DOMOutputter();
- return( outputter.output( root ) );
- }
- catch( Exception e ) {
- throw new AxisFault( e );
- }
+ root.setAttributeNS( Constants.URI_SOAP_ENV,
+ Constants.NSPREFIX_SOAP_ENV + ":" +
+ Constants.ATTR_ACTOR,
+ actor );
}
public void setProcessed(boolean value) {
1.2 +9 -6 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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultHandlerRegistry.java 2001/03/22 14:49:04 1.1
+++ DefaultHandlerRegistry.java 2001/03/30 17:48:48 1.2
@@ -57,8 +57,6 @@
import java.io.* ;
import java.util.* ;
-import org.jdom.* ;
-import org.jdom.input.DOMBuilder ;
import org.apache.axis.* ;
import org.apache.axis.utils.Debug ;
@@ -66,6 +64,9 @@
import org.apache.axis.suppliers.* ;
import org.apache.axis.registries.* ;
+import org.w3c.dom.* ;
+import javax.xml.parsers.* ;
+
/**
*
* @author Doug Davis (dug@us.ibm.com)
@@ -156,11 +157,13 @@
input = new ByteArrayInputStream( (onServer ? serverXML :
clientXML).getBytes() );
- DOMBuilder builder = new DOMBuilder();
- Document doc = null ;
-
try {
- doc = builder.build( input );
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ Document doc = null ;
+
+ doc = db.parse( input );
admin.AdminService( msgContext, doc );
}
catch( Exception e ) {
1.2 +9 -6 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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultServiceRegistry.java 2001/03/22 14:49:04 1.1
+++ DefaultServiceRegistry.java 2001/03/30 17:48:48 1.2
@@ -57,8 +57,6 @@
import java.io.* ;
import java.util.* ;
-import org.jdom.* ;
-import org.jdom.input.DOMBuilder ;
import org.apache.axis.* ;
import org.apache.axis.utils.Debug ;
@@ -66,6 +64,9 @@
import org.apache.axis.suppliers.* ;
import org.apache.axis.registries.* ;
+import org.w3c.dom.* ;
+import javax.xml.parsers.* ;
+
/**
*
* @author Doug Davis (dug@us.ibm.com)
@@ -132,11 +133,13 @@
input = new ByteArrayInputStream( (onServer ? serverXML :
clientXML).getBytes() );
- DOMBuilder builder = new DOMBuilder();
- Document doc = null ;
-
try {
- doc = builder.build( input );
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ Document doc = null ;
+
+ doc = db.parse( input );
admin.AdminService( msgContext, doc );
}
catch( Exception e ) {
1.11 +36 -17 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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- HTTPDispatchHandler.java 2001/03/26 21:42:53 1.10
+++ HTTPDispatchHandler.java 2001/03/30 17:48:50 1.11
@@ -59,9 +59,7 @@
import java.net.* ;
import java.util.* ;
import java.lang.reflect.*;
-import org.jdom.* ;
-import org.jdom.input.SAXBuilder ;
-import org.jdom.output.XMLOutputter ;
+
import org.apache.axis.* ;
import org.apache.axis.utils.* ;
import org.apache.axis.message.RPCArg;
@@ -72,6 +70,11 @@
import org.apache.axis.handlers.BasicHandler;
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.
*
@@ -86,14 +89,14 @@
Message outMsg = null ;
String reqEnv = null ;
- targetURL = (String) msgContext.getProperty( MessageContext.TRANS_URL);
+ targetURL = msgContext.getStrProp( MessageContext.TRANS_URL);
try {
String host ;
- int port = 80 ;
- String action = (String) msgContext.getProperty( HTTPConstants.MC_HTTP_SOAPACTION );
- URL tmpURL = new URL( targetURL );
- byte[] buf = new byte[4097];
- int rc = 0 ;
+ int port = 80 ;
+ String action = msgContext.getStrProp(HTTPConstants.MC_HTTP_SOAPACTION);
+ URL tmpURL = new URL( targetURL );
+ byte[] buf = new byte[4097];
+ int rc = 0 ;
host = tmpURL.getHost();
if ( (port = tmpURL.getPort()) == -1 ) port = 80;
@@ -141,8 +144,8 @@
String userID = null ;
String passwd = null ;
- userID = (String) msgContext.getProperty( MessageContext.USERID );
- passwd = (String) msgContext.getProperty( MessageContext.PASSWORD );
+ userID = msgContext.getStrProp( MessageContext.USERID );
+ passwd = msgContext.getStrProp( MessageContext.PASSWORD );
if ( userID != null )
otherHeaders = HTTPConstants.HEADER_AUTHORIZATION + ": Basic " +
@@ -156,7 +159,7 @@
+ reqEnv.length() + "\n" +
HTTPConstants.HEADER_CONTENT_TYPE + ": text/xml\n" +
(otherHeaders == null ? "" : otherHeaders) +
- HTTPConstants.HEADER_SOAP_ACTION + ": \"" + action + "\"\n\n" ;
+ HTTPConstants.HEADER_SOAP_ACTION+": \""+action+"\"\n\n";
out.write( header.getBytes() );
out.write( reqEnv.getBytes() );
@@ -214,20 +217,36 @@
// really bad must be going on - so just dump the input stream
// to stdout.
while ( (b = (byte) inp.read()) != -1 )
- System.err.print(b);
+ System.err.print((char)b);
System.err.println("");
}
if ( b != -1 ) {
- SAXBuilder parser = new SAXBuilder();
- Document doc = parser.build(inp);
+ 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();
+ }
+
outMsg = new Message( doc, "Document" );
msgContext.setResponseMessage( outMsg );
+
Debug.Print( 1, "\nXML received:" );
Debug.Print( 1, "---------------------------------------------------");
- Debug.Print( 1, (new XMLOutputter()).outputString(doc) );
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ XMLSerializer xs = new XMLSerializer( baos, new OutputFormat() );
+ xs.serialize( (Document) doc );
+ baos.close();
+ Debug.Print( 1, baos.toString() );
}
-
inp.close();
out.close();
sock.close();
1.22 +76 -53 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.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- Admin.java 2001/03/28 20:12:58 1.21
+++ Admin.java 2001/03/30 17:48:51 1.22
@@ -57,14 +57,14 @@
import java.io.* ;
import java.util.* ;
-import org.jdom.* ;
-import org.jdom.input.SAXBuilder ;
+import org.apache.axis.* ;
import org.apache.axis.registries.* ;
import org.apache.axis.handlers.* ;
import org.apache.axis.utils.* ;
import org.apache.axis.suppliers.*;
-import org.apache.axis.* ;
+import org.w3c.dom.* ;
+import javax.xml.parsers.* ;
/**
*
@@ -88,13 +88,15 @@
}
private void getOptions(Element root, Handler handler) {
- List list = root.getChildren( "option" );
+ NodeList list = root.getChildNodes();
+ for ( int i = 0 ; list != null && i < list.getLength() ; i++ ) {
+ Node node = list.item(i);
+ if ( node.getNodeType() != Node.ELEMENT_NODE ) continue ;
+ Element elem = (Element) node ;
+ if ( !"option".equals(elem.getLocalName()) ) continue ;
+ String name = elem.getAttribute( "name" );
+ String value = elem.getAttribute( "value" );
- for ( int i = 0 ; list != null && i < list.size() ; i++ ) {
- Element elem = (Element) list.get(i);
- String name = elem.getAttributeValue( "name" );
- String value = elem.getAttributeValue( "value" );
-
if ( name != null && value != null )
handler.addOption( name, value );
}
@@ -112,7 +114,7 @@
}
public Document process(Document doc) throws AxisFault {
- return( process( doc.getRootElement() ) );
+ return( process( doc.getDocumentElement() ) );
}
public Document process(Element root) throws AxisFault {
@@ -120,7 +122,7 @@
try {
init();
ClassLoader cl = new AxisClassLoader();
- String action = root.getName();
+ String action = root.getLocalName();
if ( !action.equals("deploy") && !action.equals("undeploy") &&
!action.equals("list") )
@@ -133,8 +135,16 @@
String[] names ;
Handler h ;
int i, j ;
- root = new Element("Admin");
- doc = new Document(root);
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ DocumentBuilder db = dbf.newDocumentBuilder();
+
+ doc = db.newDocument();
+
+ root = doc.createElement( "Admin" );
+ doc.appendChild( root );
+
Element elem = null ;
Hashtable opts = null ;
@@ -153,33 +163,34 @@
if ( elem == null ) continue ;
if ( loop == 1 ) {
- // Apparently there isn't anyway to change the name
- // on an Element in JDom. Strange.
- Element tmpElem = new Element( "service" );
- tmpElem.setChildren( elem.getChildren() );
- tmpElem.setAttributes( elem.getAttributes() );
- elem.removeChildren();
- elem = tmpElem ;
+ elem.setNodeValue( "service" );
+
+ // Element tmpElem = doc.createElement( "service" );
+ // tmpElem.setChildren( elem.getChildren() );
+ // tmpElem.setAttributes( elem.getAttributes() );
+ // elem.removeChildren();
+ // elem = tmpElem ;
}
- if ( elem.getName().equals("chain") )
+ if ( elem.getTagName().equals("chain") )
elem.removeAttribute( "class" );
-
- List l = elem.getAttributes();
- l.add( 0, new Attribute( "name", names[i] ) );
- elem.setAttributes( l );
- root.addContent( elem );
+
+ elem.setAttribute( "name", names[i] );
+ root.appendChild( doc.importNode(elem,true) );
}
}
return( doc );
}
- List list = root.getChildren();
- for ( int loop = 0 ; loop < list.size() ; loop++ ) {
- Object node = list.get(loop);
+ NodeList list = root.getChildNodes();
+ for ( int loop = 0 ; loop < list.getLength() ; loop++ ) {
+ Node node = list.item(loop);
+
+ if ( node.getNodeType() != Node.ELEMENT_NODE ) continue ;
+
Element elem = (Element) node ;
- String type = elem.getName();
- String name = elem.getAttributeValue( "name" );
+ String type = elem.getLocalName();
+ String name = elem.getAttribute( "name" );
if ( action.equals( "undeploy" ) ) {
if ( type.equals("service") ) {
@@ -200,18 +211,18 @@
Handler h = null ;
String hName ;
Handler tmpH ;
- String flow = elem.getAttributeValue( "flow" );
- String input = elem.getAttributeValue( "input" );
- String pivot = elem.getAttributeValue( "pivot" );
- String output = elem.getAttributeValue( "output" );
+ String flow = elem.getAttribute( "flow" );
+ String input = elem.getAttribute( "input" );
+ String pivot = elem.getAttribute( "pivot" );
+ String output = elem.getAttribute( "output" );
if ( type.equals( "handler" ) ) {
- String cls = elem.getAttributeValue( "class" );
+ String cls = elem.getAttribute( "class" );
Debug.Print( 2, "Deploying handler: " + name );
if (hr instanceof SupplierRegistry) {
- String lifeCycle = elem.getAttributeValue("lifecycle");
+ String lifeCycle = elem.getAttribute("lifecycle");
Supplier supplier;
if ("factory".equals(lifeCycle)) {
@@ -264,9 +275,9 @@
else cc.clear();
st = new StringTokenizer( input, " \t\n\r\f," );
- c = new SimpleChain();
- cc.setInputChain( c );
while ( st.hasMoreElements() ) {
+ if ( c == null )
+ cc.setInputChain( c = new SimpleChain() );
hName = st.nextToken();
tmpH = hr.find( hName );
if ( tmpH == null )
@@ -279,9 +290,10 @@
cc.setPivotHandler( hr.find( pivot ) );
st = new StringTokenizer( output, " \t\n\r\f," );
- c = new SimpleChain();
- cc.setOutputChain( c );
+ c = null ;
while ( st.hasMoreElements() ) {
+ if ( c == null )
+ cc.setOutputChain( c = new SimpleChain() );
hName = st.nextToken();
tmpH = hr.find( hName );
if ( tmpH == null )
@@ -310,11 +322,12 @@
if ( cc == null ) cc = new SimpleTargetedChain();
else cc.clear();
- if ( input != null ) {
+ if ( input != null && !"".equals(input) ) {
st = new StringTokenizer( input, " \t\n\r\f," );
- c = new SimpleChain();
- cc.setInputChain( c );
+ c = null ;
while ( st.hasMoreElements() ) {
+ if ( c == null )
+ cc.setInputChain( c = new SimpleChain() );
hName = st.nextToken();
tmpH = hr.find( hName );
if ( tmpH == null )
@@ -325,14 +338,15 @@
}
}
- if ( pivot != null )
+ if ( pivot != null && !"".equals(pivot) )
cc.setPivotHandler( hr.find( pivot ) );
- if ( output != null ) {
+ if ( output != null && !"".equals(output) ) {
st = new StringTokenizer( output, " \t\n\r\f," );
- c = new SimpleChain();
- cc.setOutputChain( c );
+ c = null ;
while ( st.hasMoreElements() ) {
+ if ( c == null )
+ cc.setOutputChain( c = new SimpleChain() );
hName = st.nextToken();
tmpH = hr.find( hName );
if ( tmpH == null )
@@ -351,11 +365,18 @@
"Unknown type to " + action + ": " + type,
null, null );
}
- root = new Element( "Admin" );
- doc = new Document(root);
- root.addContent( "Done processing" );
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ DocumentBuilder db = dbf.newDocumentBuilder();
+
+ doc = db.newDocument();
+
+ doc.appendChild( root = doc.createElement( "Admin" ) );
+ root.appendChild( doc.createTextNode( "Done processing" ) );
}
catch( Exception e ) {
+ e.printStackTrace();
throw new AxisFault( e );
}
return( doc );
@@ -389,12 +410,14 @@
try {
for ( i = 0 ; i < args.length ; i++ ) {
- SAXBuilder parser = new SAXBuilder();
Document doc = null ;
System.out.println( "Processing '" + args[i] + "'" );
- doc = parser.build( new FileInputStream(args[i]) );
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ doc = db.parse( new FileInputStream( args[i] ) );
admin.process( doc );
}
1.2 +2 -0 xml-axis/java/src/org/apache/axis/utils/LockableHashtable.java
Index: LockableHashtable.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/LockableHashtable.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LockableHashtable.java 2001/03/29 00:04:35 1.1
+++ LockableHashtable.java 2001/03/30 17:48:52 1.2
@@ -52,6 +52,8 @@
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
+package org.apache.axis.utils ;
+
import java.util.Hashtable;
import java.util.Vector;