dims 2002/06/22 16:14:05
Modified: java/src/org/apache/axis AxisFault.java
java/src/org/apache/axis/client Call.java
java/src/org/apache/axis/message BodyBuilder.java
Detail.java SOAPFault.java SOAPFaultBuilder.java
SOAPFaultElement.java
java/src/org/apache/axis/transport/http AxisServlet.java
SimpleAxisWorker.java
java/src/org/apache/axis/transport/local LocalSender.java
java/test/faults FaultDecode.java FaultEncode.java
Log:
Cleanup fault related interfaces for SAAJ compliance. BodyBuilder should build
SOAPFault's (both JAXRPC and AXIS)
For a bit more info see note from Glyn
(http://marc.theaimsgroup.com/?l=axis-dev&m=102276364622969&w=2)
Revision Changes Path
1.50 +3 -3 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.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- AxisFault.java 22 Jun 2002 16:14:37 -0000 1.49
+++ AxisFault.java 22 Jun 2002 23:14:04 -0000 1.50
@@ -57,7 +57,7 @@
import org.apache.axis.encoding.SerializationContext;
import org.apache.axis.message.SOAPEnvelope;
-import org.apache.axis.message.SOAPFaultElement;
+import org.apache.axis.message.SOAPFault;
import org.apache.axis.utils.JavaUtils;
import org.apache.axis.utils.XMLUtils;
@@ -299,8 +299,8 @@
SOAPEnvelope envelope = new SOAPEnvelope();
- SOAPFaultElement fault =
- new SOAPFaultElement(this);
+ SOAPFault fault =
+ new SOAPFault(this);
envelope.addBodyElement(fault);
envelope.output(context);
1.146 +3 -3 xml-axis/java/src/org/apache/axis/client/Call.java
Index: Call.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Call.java,v
retrieving revision 1.145
retrieving revision 1.146
diff -u -r1.145 -r1.146
--- Call.java 21 Jun 2002 18:37:48 -0000 1.145
+++ Call.java 22 Jun 2002 23:14:04 -0000 1.146
@@ -79,7 +79,7 @@
import org.apache.axis.message.RPCParam;
import org.apache.axis.message.SOAPBodyElement;
import org.apache.axis.message.SOAPEnvelope;
-import org.apache.axis.message.SOAPFaultElement;
+import org.apache.axis.message.SOAPFault;
import org.apache.axis.message.SOAPHeaderElement;
import org.apache.axis.transport.http.HTTPTransport;
import org.apache.axis.utils.JavaUtils;
@@ -1993,8 +1993,8 @@
SOAPEnvelope resEnv = (SOAPEnvelope)resMsg.getSOAPEnvelope();
SOAPBodyElement respBody = resEnv.getFirstBody();
- if (respBody instanceof SOAPFaultElement) {
- throw ((SOAPFaultElement)respBody).getFault();
+ if (respBody instanceof SOAPFault) {
+ throw ((SOAPFault)respBody).getFault();
}
}
1.39 +2 -2 xml-axis/java/src/org/apache/axis/message/BodyBuilder.java
Index: BodyBuilder.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/BodyBuilder.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- BodyBuilder.java 21 Jun 2002 20:50:16 -0000 1.38
+++ BodyBuilder.java 22 Jun 2002 23:14:04 -0000 1.39
@@ -152,9 +152,9 @@
*/
if (localName.equals(Constants.ELEM_FAULT) &&
namespace.equals(msgContext.getSOAPConstants().getEnvelopeURI())) {
- element = new SOAPFaultElement(namespace, localName, prefix,
+ element = new SOAPFault(namespace, localName, prefix,
attributes, context);
- handler = new SOAPFaultBuilder((SOAPFaultElement)element,
+ handler = new SOAPFaultBuilder((SOAPFault)element,
context);
} else if (!gotRPCElement) {
if (isRoot &&
1.3 +1 -1 xml-axis/java/src/org/apache/axis/message/Detail.java
Index: Detail.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/Detail.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Detail.java 22 Jun 2002 19:09:24 -0000 1.2
+++ Detail.java 22 Jun 2002 23:14:04 -0000 1.3
@@ -69,7 +69,7 @@
*
* @author Davanum Srinivas ([EMAIL PROTECTED])
*/
-public class Detail extends SOAPFaultElement implements javax.xml.soap.Detail {
+public class Detail extends SOAPFault implements javax.xml.soap.Detail {
public Detail(String namespace, String localName, String prefix,
Attributes attrs, DeserializationContext context) {
1.2 +103 -24 xml-axis/java/src/org/apache/axis/message/SOAPFault.java
Index: SOAPFault.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPFault.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SOAPFault.java 29 May 2002 17:00:00 -0000 1.1
+++ SOAPFault.java 22 Jun 2002 23:14:04 -0000 1.2
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 2002 The Apache Software Foundation. All rights
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -52,18 +52,100 @@
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
-
package org.apache.axis.message;
-import javax.xml.soap.Detail;
-import javax.xml.soap.SOAPException;
-
-/**
- * SOAP Fault implementation
- *
- * @author Davanum Srinivas ([EMAIL PROTECTED])
+import org.apache.axis.AxisFault;
+import org.apache.axis.Constants;
+import org.apache.axis.encoding.DeserializationContext;
+import org.apache.axis.encoding.SerializationContext;
+import org.w3c.dom.Element;
+import org.xml.sax.Attributes;
+
+import javax.xml.namespace.QName;
+
+import java.io.IOException;
+
+/** A Fault body element.
+ *
+ * @author Sam Ruby ([EMAIL PROTECTED])
+ * @author Glen Daniels ([EMAIL PROTECTED])
+ * @author Tom Jordahl ([EMAIL PROTECTED])
*/
-public class SOAPFault extends MessageElement implements javax.xml.soap.SOAPFault {
+public class SOAPFault extends SOAPBodyElement implements javax.xml.soap.SOAPFault
+{
+ protected AxisFault fault;
+
+ public SOAPFault(String namespace, String localName, String prefix,
+ Attributes attrs, DeserializationContext context)
+ {
+ super(namespace, localName, prefix, attrs, context);
+ this.fault = fault;
+ namespaceURI = Constants.URI_SOAP11_ENV;
+ name = Constants.ELEM_FAULT;
+ }
+
+ public SOAPFault(AxisFault fault)
+ {
+ this.fault = fault;
+ namespaceURI = Constants.URI_SOAP11_ENV;
+ name = Constants.ELEM_FAULT;
+ }
+
+ public void outputImpl(SerializationContext context)
+ throws IOException
+ {
+ context.registerPrefixForURI(prefix, namespaceURI);
+ context.startElement(new QName(this.getNamespaceURI(),
+ this.getName()),
+ attributes);
+
+ // XXX - Can fault be anything but an AxisFault here?
+ if (fault instanceof AxisFault) {
+ AxisFault axisFault = (AxisFault) fault;
+ if (axisFault.getFaultCode() != null) {
+ // Do this BEFORE starting the element, so the prefix gets
+ // registered if needed.
+ String faultCode = context.qName2String(axisFault.getFaultCode());
+ context.startElement(Constants.QNAME_FAULTCODE, null);
+ context.writeSafeString(faultCode);
+ context.endElement();
+ }
+
+ if (axisFault.getFaultString() != null) {
+ context.startElement(Constants.QNAME_FAULTSTRING, null);
+ context.writeSafeString(axisFault.getFaultString());
+ context.endElement();
+ }
+
+ if (axisFault.getFaultActor() != null) {
+ context.startElement(Constants.QNAME_FAULTACTOR, null);
+ context.writeSafeString(axisFault.getFaultActor());
+ context.endElement();
+ }
+
+ Element[] faultDetails = axisFault.getFaultDetails();
+ if (faultDetails != null) {
+ context.startElement(Constants.QNAME_FAULTDETAILS, null);
+ for (int i = 0; i < faultDetails.length; i++) {
+ context.writeDOMElement(faultDetails[i]);
+ }
+ context.endElement();
+ }
+ }
+
+ context.endElement();
+ }
+
+ public AxisFault getFault()
+ {
+ return fault;
+ }
+
+ public void setFault(AxisFault fault)
+ {
+ this.fault = fault;
+ }
+
/**
* Sets this <CODE>SOAPFaultException</CODE> object with the given
* fault code.
@@ -77,8 +159,8 @@
* adding the <CODE>faultCode</CODE> to the underlying XML
* tree.
*/
- public void setFaultCode(String faultCode) throws SOAPException {
- //TODO: Flesh this out.
+ public void setFaultCode(String faultCode) throws javax.xml.soap.SOAPException {
+ fault.setFaultCode(faultCode);
}
/**
@@ -87,8 +169,7 @@
* @return a <CODE>String</CODE> with the fault code
*/
public String getFaultCode() {
- //TODO: Flesh this out.
- return null;
+ return fault.getFaultCode().toString();
}
/**
@@ -104,8 +185,8 @@
* adding the <CODE>faultActor</CODE> to the underlying XML
* tree.
*/
- public void setFaultActor(String faultActor) throws SOAPException {
- //TODO: Flesh this out.
+ public void setFaultActor(String faultActor) throws
javax.xml.soap.SOAPException {
+ fault.setFaultActor(faultActor);
}
/**
@@ -116,8 +197,7 @@
* @see #setFaultActor(java.lang.String) setFaultActor(java.lang.String)
*/
public String getFaultActor() {
- //TODO: Flesh this out.
- return null;
+ return fault.getFaultActor();
}
/**
@@ -132,8 +212,8 @@
* @see #getFaultString() getFaultString()
*/
public void setFaultString(String faultString)
- throws SOAPException {
- //TODO: Flesh this out.
+ throws javax.xml.soap.SOAPException {
+ fault.setFaultString(faultString);
}
/**
@@ -143,8 +223,7 @@
* fault
*/
public String getFaultString() {
- //TODO: Flesh this out.
- return null;
+ return fault.getFaultString();
}
/**
@@ -157,7 +236,7 @@
* @return a <CODE>Detail</CODE> object with
* application-specific error information
*/
- public Detail getDetail() {
+ public javax.xml.soap.Detail getDetail() {
//TODO: Flesh this out.
return null;
}
@@ -175,7 +254,7 @@
* <CODE>SOAPFaultException</CODE> object already contains a valid
* <CODE>Detail</CODE> object
*/
- public Detail addDetail() throws SOAPException {
+ public javax.xml.soap.Detail addDetail() throws javax.xml.soap.SOAPException {
//TODO: Flesh this out.
return null;
}
1.23 +2 -2 xml-axis/java/src/org/apache/axis/message/SOAPFaultBuilder.java
Index: SOAPFaultBuilder.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPFaultBuilder.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- SOAPFaultBuilder.java 20 Jun 2002 16:48:19 -0000 1.22
+++ SOAPFaultBuilder.java 22 Jun 2002 23:14:04 -0000 1.23
@@ -81,7 +81,7 @@
*/
public class SOAPFaultBuilder extends SOAPHandler implements Callback
{
- protected SOAPFaultElement element;
+ protected SOAPFault element;
protected DeserializationContext context;
static HashMap fields = new HashMap();
@@ -99,7 +99,7 @@
fields.put(Constants.ELEM_FAULT_DETAIL, null);
}
- public SOAPFaultBuilder(SOAPFaultElement element,
+ public SOAPFaultBuilder(SOAPFault element,
DeserializationContext context) {
this.element = element;
this.context = context;
1.26 +12 -90 xml-axis/java/src/org/apache/axis/message/SOAPFaultElement.java
Index: SOAPFaultElement.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPFaultElement.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- SOAPFaultElement.java 11 Jun 2002 14:53:59 -0000 1.25
+++ SOAPFaultElement.java 22 Jun 2002 23:14:04 -0000 1.26
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -10,7 +10,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
@@ -18,7 +18,7 @@
* distribution.
*
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
@@ -26,7 +26,7 @@
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
- * software without prior written permission. For written
+ * software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
@@ -52,94 +52,16 @@
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
-package org.apache.axis.message;
-
-import org.apache.axis.AxisFault;
-import org.apache.axis.Constants;
-import org.apache.axis.encoding.DeserializationContext;
-import org.apache.axis.encoding.SerializationContext;
-import org.w3c.dom.Element;
-import org.xml.sax.Attributes;
-import javax.xml.namespace.QName;
+package org.apache.axis.message;
-import java.io.IOException;
+import javax.xml.soap.Detail;
+import javax.xml.soap.SOAPException;
-/** A Fault body element.
- *
- * @author Sam Ruby ([EMAIL PROTECTED])
- * @author Glen Daniels ([EMAIL PROTECTED])
- * @author Tom Jordahl ([EMAIL PROTECTED])
+/**
+ * SOAP Fault implementation
+ *
+ * @author Davanum Srinivas ([EMAIL PROTECTED])
*/
-public class SOAPFaultElement extends SOAPBodyElement implements
javax.xml.soap.SOAPFaultElement
-{
- protected AxisFault fault;
-
- public SOAPFaultElement(String namespace, String localName, String prefix,
- Attributes attrs, DeserializationContext context)
- {
- super(namespace, localName, prefix, attrs, context);
- }
-
- public SOAPFaultElement(AxisFault fault)
- {
- this.fault = fault;
- namespaceURI = Constants.URI_SOAP11_ENV;
- name = Constants.ELEM_FAULT;
- }
-
- public void outputImpl(SerializationContext context)
- throws IOException
- {
- context.registerPrefixForURI(prefix, namespaceURI);
- context.startElement(new QName(this.getNamespaceURI(),
- this.getName()),
- attributes);
-
- // XXX - Can fault be anything but an AxisFault here?
- if (fault instanceof AxisFault) {
- AxisFault axisFault = (AxisFault) fault;
- if (axisFault.getFaultCode() != null) {
- // Do this BEFORE starting the element, so the prefix gets
- // registered if needed.
- String faultCode = context.qName2String(axisFault.getFaultCode());
- context.startElement(Constants.QNAME_FAULTCODE, null);
- context.writeSafeString(faultCode);
- context.endElement();
- }
-
- if (axisFault.getFaultString() != null) {
- context.startElement(Constants.QNAME_FAULTSTRING, null);
- context.writeSafeString(axisFault.getFaultString());
- context.endElement();
- }
-
- if (axisFault.getFaultActor() != null) {
- context.startElement(Constants.QNAME_FAULTACTOR, null);
- context.writeSafeString(axisFault.getFaultActor());
- context.endElement();
- }
-
- Element[] faultDetails = axisFault.getFaultDetails();
- if (faultDetails != null) {
- context.startElement(Constants.QNAME_FAULTDETAILS, null);
- for (int i = 0; i < faultDetails.length; i++) {
- context.writeDOMElement(faultDetails[i]);
- }
- context.endElement();
- }
- }
-
- context.endElement();
- }
-
- public AxisFault getFault()
- {
- return fault;
- }
-
- public void setFault(AxisFault fault)
- {
- this.fault = fault;
- }
+public class SOAPFaultElement extends MessageElement implements
javax.xml.soap.SOAPFaultElement {
}
1.117 +1 -1
xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java
Index: AxisServlet.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -r1.116 -r1.117
--- AxisServlet.java 21 Jun 2002 19:48:40 -0000 1.116
+++ AxisServlet.java 22 Jun 2002 23:14:05 -0000 1.117
@@ -65,7 +65,7 @@
import org.apache.axis.description.OperationDesc;
import org.apache.axis.configuration.ServletEngineConfigurationFactory;
import org.apache.axis.message.SOAPEnvelope;
-import org.apache.axis.message.SOAPFaultElement;
+import org.apache.axis.message.SOAPFault;
import org.apache.axis.security.servlet.ServletSecurityProvider;
import org.apache.axis.server.AxisServer;
import org.apache.axis.utils.Admin;
1.5 +2 -2
xml-axis/java/src/org/apache/axis/transport/http/SimpleAxisWorker.java
Index: SimpleAxisWorker.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/transport/http/SimpleAxisWorker.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SimpleAxisWorker.java 11 Jun 2002 14:32:03 -0000 1.4
+++ SimpleAxisWorker.java 22 Jun 2002 23:14:05 -0000 1.5
@@ -61,7 +61,7 @@
import org.apache.axis.MessageContext;
import org.apache.axis.encoding.Base64;
import org.apache.axis.message.SOAPEnvelope;
-import org.apache.axis.message.SOAPFaultElement;
+import org.apache.axis.message.SOAPFault;
import org.apache.axis.server.AxisServer;
import org.apache.axis.utils.JavaUtils;
import org.apache.axis.utils.XMLUtils;
@@ -420,7 +420,7 @@
try {
SOAPEnvelope env = responseMsg.getSOAPEnvelope();
env.clearBody();
- env.addBodyElement(new SOAPFaultElement((AxisFault) e));
+ env.addBodyElement(new SOAPFault((AxisFault) e));
} catch (AxisFault fault) {
// Should never reach here!
}
1.32 +2 -2
xml-axis/java/src/org/apache/axis/transport/local/LocalSender.java
Index: LocalSender.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/transport/local/LocalSender.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- LocalSender.java 29 May 2002 14:30:01 -0000 1.31
+++ LocalSender.java 22 Jun 2002 23:14:05 -0000 1.32
@@ -61,7 +61,7 @@
import org.apache.axis.MessageContext;
import org.apache.axis.handlers.BasicHandler;
import org.apache.axis.message.SOAPEnvelope;
-import org.apache.axis.message.SOAPFaultElement;
+import org.apache.axis.message.SOAPFault;
import org.apache.axis.server.AxisServer;
import org.apache.axis.utils.JavaUtils;
import org.apache.commons.logging.Log;
@@ -162,7 +162,7 @@
respMsg = new Message(fault);
serverContext.setResponseMessage(respMsg);
} else {
- SOAPFaultElement faultEl = new SOAPFaultElement(fault);
+ SOAPFault faultEl = new SOAPFault(fault);
SOAPEnvelope env = respMsg.getSOAPEnvelope();
env.clearBody();
env.addBodyElement(faultEl);
1.12 +5 -5 xml-axis/java/test/faults/FaultDecode.java
Index: FaultDecode.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/faults/FaultDecode.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- FaultDecode.java 11 Jun 2002 14:54:03 -0000 1.11
+++ FaultDecode.java 22 Jun 2002 23:14:05 -0000 1.12
@@ -54,9 +54,8 @@
*/
package test.faults;
-import junit.framework.TestCase;
-import junit.framework.TestResult;
import junit.framework.Test;
+import junit.framework.TestCase;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
import org.apache.axis.AxisFault;
@@ -64,10 +63,11 @@
import org.apache.axis.MessageContext;
import org.apache.axis.message.SOAPBodyElement;
import org.apache.axis.message.SOAPEnvelope;
-import org.apache.axis.message.SOAPFaultElement;
+import org.apache.axis.message.SOAPFault;
import org.apache.axis.server.AxisServer;
import org.w3c.dom.Element;
import org.w3c.dom.Text;
+
import javax.xml.namespace.QName;
/**
@@ -114,8 +114,8 @@
SOAPBodyElement respBody = envelope.getFirstBody();
assertTrue("respBody should be a SOAPFaultElement", respBody
- instanceof SOAPFaultElement);
- AxisFault aFault = ((SOAPFaultElement) respBody).getFault();
+ instanceof SOAPFault);
+ AxisFault aFault = ((SOAPFault) respBody).getFault();
assertNotNull("Fault should not be null", aFault);
1.6 +0 -10 xml-axis/java/test/faults/FaultEncode.java
Index: FaultEncode.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/faults/FaultEncode.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- FaultEncode.java 11 Jun 2002 14:54:03 -0000 1.5
+++ FaultEncode.java 22 Jun 2002 23:14:05 -0000 1.6
@@ -55,20 +55,10 @@
package test.faults;
import junit.framework.TestCase;
-import junit.framework.TestResult;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import junit.textui.TestRunner;
import org.apache.axis.AxisFault;
import org.apache.axis.Message;
import org.apache.axis.MessageContext;
-import org.apache.axis.message.SOAPBodyElement;
-import org.apache.axis.message.SOAPEnvelope;
-import org.apache.axis.message.SOAPFaultElement;
import org.apache.axis.server.AxisServer;
-import org.w3c.dom.Element;
-import org.w3c.dom.Text;
-import javax.xml.namespace.QName;
/**
* This class tests Fault deserialization.