butek 02/04/02 14:05:19
Modified: java/src/javax/xml/rpc/namespace QName.java
java/src/org/apache/axis AxisFault.java Constants.java
java/src/org/apache/axis/deployment/v2dd V2DDMap.java
java/src/org/apache/axis/encoding
DefaultTypeMappingImpl.java
java/src/org/apache/axis/message SOAPFaultBuilder.java
java/src/org/apache/axis/wsdl/toJava JavaImplWriter.java
JavaTestCaseWriter.java
java/test/encoding TestDeser2001.java
java/test/faults FaultDecode.java FaultEncode.java
java/test/soap PackageTests.java
java/test/utils PackageTests.java TestQName.java
Added: java/src/org/apache/axis/encoding/ser QNameDeserializer.java
QNameDeserializerFactory.java QNameSerializer.java
QNameSerializerFactory.java
Removed: java/src/org/apache/axis/utils QFault.java
java/test/utils TestQFault.java
Log:
I just wanted to do a simple task! But nothing's been simple for me lately!
All I wanted to do was get our QName in line with JAX-RPC. This meant:
- remove the default ctor
- remove the Element ctor
- remove the setters
This alone rippled through a number of files. But THEN I found that we
were serializing the primitive type QName as a bean, so I had to add
QName serialization code, too. AND change/add tests. And I'm not even
done, yet! "new QName(null, null)" is supposed to throw IllegalArgumentException
but we just convert this to "", "". I'm going to have to make another pass
through the code to fix THAT one! (whinewhine)
Revision Changes Path
1.11 +4 -54 xml-axis/java/src/javax/xml/rpc/namespace/QName.java
Index: QName.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/javax/xml/rpc/namespace/QName.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- QName.java 15 Feb 2002 19:41:17 -0000 1.10
+++ QName.java 2 Apr 2002 22:05:18 -0000 1.11
@@ -55,11 +55,6 @@
package javax.xml.rpc.namespace;
-import org.apache.axis.Constants;
-import org.w3c.dom.Element;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Node;
-
/**
* QName class represents a qualified name based on "Namespaces in XML"
specification.
* A QName is represented as:
@@ -80,11 +75,6 @@
/**
* Constructor for the QName.
- */
- public QName() {}
-
- /**
- * Constructor for the QName.
*
* @param localPart - Local part of the QName
*/
@@ -109,8 +99,9 @@
*
* @param namespaceURI
*/
- public void setNamespaceURI(String namespaceURI) {
+ private void setNamespaceURI(String namespaceURI) {
if (namespaceURI == null)
+// should throw exception, but gotta clean up first throw new
IllegalArgumentException("namespaceURI == null");
namespaceURI = "";
this.namespaceURI = namespaceURI;
}
@@ -129,8 +120,9 @@
*
* @param localPart
*/
- public void setLocalPart(String localPart) {
+ private void setLocalPart(String localPart) {
if (localPart == null)
+// should throw exception, but gotta clean up first throw new
IllegalArgumentException("localPart == null");
localPart = "";
this.localPart = localPart;
}
@@ -188,48 +180,6 @@
*/
public int hashCode() {
return namespaceURI.hashCode() ^ localPart.hashCode();
- }
-
- // temporary!!
-
- /**
- * Constructor for the QName.
- *
- * @param qName
- * @param element
- */
- public QName(String qName, org.w3c.dom.Element element) {
-
- if (qName != null) {
- int i = qName.indexOf(":");
-
- if (i < 0) {
- setLocalPart(qName);
- // Find default namespace
- while (element != null) {
- Attr attr =
- element.getAttributeNodeNS(Constants.NS_URI_XMLNS,
- "xmlns");
- if (attr != null) {
- setNamespaceURI(attr.getValue());
- return;
- }
- Node n = element.getParentNode();
- if (! (n instanceof Element))
- break;
- element = (Element)n;
- }
- // didn't find a namespace
- setNamespaceURI("");
- } else {
- String prefix = qName.substring(0, i);
- String local = qName.substring(i + 1);
-
- setLocalPart(local);
- setNamespaceURI(org.apache.axis.utils.XMLUtils
- .getNamespace(prefix, element));
- }
- }
}
}
1.42 +8 -7 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.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- AxisFault.java 29 Mar 2002 23:25:01 -0000 1.41
+++ AxisFault.java 2 Apr 2002 22:05:18 -0000 1.42
@@ -58,7 +58,6 @@
import org.apache.axis.encoding.SerializationContext;
import org.apache.axis.message.SOAPEnvelope;
import org.apache.axis.message.SOAPFaultElement;
-import org.apache.axis.utils.QFault;
import org.apache.axis.utils.XMLUtils;
import org.apache.commons.logging.Log;
@@ -73,6 +72,8 @@
import java.lang.reflect.InvocationTargetException;
import java.util.Vector;
+import javax.xml.rpc.namespace.QName;
+
/**
* An exception which maps cleanly to a SOAP fault.
* This is a base class for exceptions which are mapped to faults.
@@ -87,7 +88,7 @@
private static final String LS = System.getProperty("line.separator");
- protected QFault faultCode ;
+ protected QName faultCode ;
protected String faultString = "";
protected String faultActor ;
protected Vector faultDetails ; // vector of Element's
@@ -118,7 +119,7 @@
public AxisFault(String code, String str,
String actor, Element[] details) {
super (str);
- setFaultCode( new QFault(Constants.AXIS_NS, code));
+ setFaultCode( new QName(Constants.AXIS_NS, code));
setFaultString( str );
setFaultActor( actor );
setFaultDetail( details );
@@ -126,7 +127,7 @@
initFromException(this);
}
- public AxisFault(QFault code, String str,
+ public AxisFault(QName code, String str,
String actor, Element[] details) {
super (str);
setFaultCode( code );
@@ -244,15 +245,15 @@
;
}
- public void setFaultCode(QFault code) {
+ public void setFaultCode(QName code) {
faultCode = code ;
}
public void setFaultCode(String code) {
- faultCode = new QFault(Constants.AXIS_NS, code);
+ faultCode = new QName(Constants.AXIS_NS, code);
}
- public QFault getFaultCode() {
+ public QName getFaultCode() {
return( faultCode );
}
1.59 +2 -3 xml-axis/java/src/org/apache/axis/Constants.java
Index: Constants.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/Constants.java,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- Constants.java 26 Mar 2002 14:36:58 -0000 1.58
+++ Constants.java 2 Apr 2002 22:05:18 -0000 1.59
@@ -55,7 +55,6 @@
package org.apache.axis;
-import org.apache.axis.utils.QFault;
import org.xml.sax.Attributes;
import javax.xml.rpc.namespace.QName;
@@ -383,8 +382,8 @@
public static final String FAULT_SERVER_USER =
"Server.userException";
- public static final QFault FAULT_MUSTUNDERSTAND =
- new QFault(URI_SOAP_ENV, "MustUnderstand");
+ public static final QName FAULT_MUSTUNDERSTAND =
+ new QName(URI_SOAP_ENV, "MustUnderstand");
// QNames
1.12 +35 -1 xml-axis/java/src/org/apache/axis/deployment/v2dd/V2DDMap.java
Index: V2DDMap.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/v2dd/V2DDMap.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- V2DDMap.java 30 Oct 2001 16:46:35 -0000 1.11
+++ V2DDMap.java 2 Apr 2002 22:05:18 -0000 1.12
@@ -54,7 +54,13 @@
*/
package org.apache.axis.deployment.v2dd;
+import org.w3c.dom.Attr;
import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import org.apache.axis.Constants;
+
+import org.apache.axis.utils.XMLUtils;
import javax.xml.rpc.namespace.QName;
@@ -72,7 +78,35 @@
public QName getQName() {
if (qname == null) {
- qname = new QName(element.getAttribute("qname"), element);
+ String qnameString = element.getAttribute("qname");
+ String namespace = "";
+ String localPart = "";
+ if (qnameString != null) {
+ int i = qnameString.indexOf(":");
+
+ if (i < 0) {
+ localPart = qnameString;
+ // Find default namespace
+ Element el = element;
+ while (el != null) {
+ Attr attr = el.getAttributeNodeNS(
+ Constants.NS_URI_XMLNS, "xmlns");
+ if (attr != null) {
+ namespace = attr.getValue();
+ break;
+ }
+ Node n = el.getParentNode();
+ el = n instanceof Element ? (Element) n : null;
+ }
+ } else {
+ String prefix = qnameString.substring(0, i);
+ String local = qnameString.substring(i + 1);
+
+ localPart = local;
+ namespace = XMLUtils.getNamespace(prefix, element);
+ }
+ }
+ qname = new QName(namespace, localPart);
}
return qname;
}
1.16 +4 -2
xml-axis/java/src/org/apache/axis/encoding/DefaultTypeMappingImpl.java
Index: DefaultTypeMappingImpl.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/DefaultTypeMappingImpl.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- DefaultTypeMappingImpl.java 31 Mar 2002 23:09:33 -0000 1.15
+++ DefaultTypeMappingImpl.java 2 Apr 2002 22:05:18 -0000 1.16
@@ -79,6 +79,8 @@
import org.apache.axis.encoding.ser.HexDeserializerFactory;
import org.apache.axis.encoding.ser.ElementSerializerFactory;
import org.apache.axis.encoding.ser.ElementDeserializerFactory;
+import org.apache.axis.encoding.ser.QNameSerializerFactory;
+import org.apache.axis.encoding.ser.QNameDeserializerFactory;
import org.apache.axis.encoding.ser.VectorDeserializerFactory;
import org.apache.axis.encoding.ser.VectorSerializerFactory;
import org.apache.axis.encoding.ser.SimpleDeserializerFactory;
@@ -241,9 +243,9 @@
// Map QNAME to the jax rpc QName class
myRegister(Constants.XSD_QNAME,
javax.xml.rpc.namespace.QName.class,
- new BeanSerializerFactory(javax.xml.rpc.namespace.QName.class,
+ new QNameSerializerFactory(javax.xml.rpc.namespace.QName.class,
Constants.XSD_QNAME),
- new BeanDeserializerFactory(javax.xml.rpc.namespace.QName.class,
+ new QNameDeserializerFactory(javax.xml.rpc.namespace.QName.class,
Constants.XSD_QNAME),
true);
1.1
xml-axis/java/src/org/apache/axis/encoding/ser/QNameDeserializer.java
Index: QNameDeserializer.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.axis.encoding.ser;
import org.apache.axis.encoding.DeserializationContext;
import org.apache.axis.utils.JavaUtils;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import javax.xml.rpc.namespace.QName;
/**
* The DateSerializer deserializes a Date. Much of the work is done in the
* base class.
*
* @author Sam Ruby ([EMAIL PROTECTED])
* Modified for JAX-RPC @author Rich Scheuerle ([EMAIL PROTECTED])
*/
public class QNameDeserializer extends SimpleDeserializer {
private DeserializationContext context = null;
/**
* The Deserializer is constructed with the xmlType and
* javaType
*/
public QNameDeserializer(Class javaType, QName xmlType) {
super(javaType, xmlType);
} // ctor
/**
* The simple deserializer provides most of the stuff.
* We just need to override makeValue().
*/
public Object makeValue(String source) {
int colon = source.lastIndexOf(":");
String namespace = colon < 0 ? "" :
context.getNamespaceURI(source.substring(0, colon));
String localPart = colon < 0 ? source : source.substring(colon + 1);
return new QName(namespace, localPart);
} // makeValue
public void onStartElement(String namespace, String localName,
String qName, Attributes attributes,
DeserializationContext context)
throws SAXException
{
this.context = context;
} // onStartElement
}
1.1
xml-axis/java/src/org/apache/axis/encoding/ser/QNameDeserializerFactory.java
Index: QNameDeserializerFactory.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.axis.encoding.ser;
import javax.xml.rpc.namespace.QName;
/**
* A QNameDeserializer Factory
*/
public class QNameDeserializerFactory extends BaseDeserializerFactory {
public QNameDeserializerFactory(Class javaType, QName xmlType) {
super(QNameDeserializer.class, false, xmlType, javaType);
}
}
1.1
xml-axis/java/src/org/apache/axis/encoding/ser/QNameSerializer.java
Index: QNameSerializer.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.axis.encoding.ser;
import org.xml.sax.Attributes;
import org.xml.sax.helpers.AttributesImpl;
import javax.xml.rpc.namespace.QName;
import java.io.IOException;
import org.apache.axis.Constants;
import org.apache.axis.wsdl.fromJava.Types;
import org.apache.axis.encoding.Serializer;
import org.apache.axis.encoding.SerializationContext;
/**
* Serializer for QNames.
*/
public class QNameSerializer implements Serializer {
/**
* Serialize a QName.
*/
public void serialize(QName name, Attributes attributes,
Object value, SerializationContext context)
throws IOException
{
QName qname = (QName) value;
AttributesImpl attrImpl = new AttributesImpl(attributes);
attrImpl.addAttribute(null, null, "xmlns:qns", null,
qname.getNamespaceURI());
context.startElement(name, attrImpl);
context.writeString("qns:" + qname.getLocalPart());
context.endElement();
}
public String getMechanismType() { return Constants.AXIS_SAX; }
/**
* Return XML schema for the specified type, suitable for insertion into
* the <types> element of a WSDL document.
*
* @param types the Java2WSDL Types object which holds the context
* for the WSDL being generated.
* @return true if we wrote a schema, false if we didn't.
* @see org.apache.axis.wsdl.fromJava.Types
*/
public boolean writeSchema(Types types) throws Exception {
return false;
}
}
1.1
xml-axis/java/src/org/apache/axis/encoding/ser/QNameSerializerFactory.java
Index: QNameSerializerFactory.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.axis.encoding.ser;
import javax.xml.rpc.namespace.QName;
/**
* SerializerFactory for QName primitive
*/
public class QNameSerializerFactory extends BaseSerializerFactory {
public QNameSerializerFactory(Class javaType, QName xmlType) {
super(QNameSerializer.class, true, xmlType, javaType); // true indicates
shared class
}
}
1.18 +3 -4 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.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- SOAPFaultBuilder.java 8 Feb 2002 23:03:36 -0000 1.17
+++ SOAPFaultBuilder.java 2 Apr 2002 22:05:18 -0000 1.18
@@ -60,7 +60,6 @@
import org.apache.axis.encoding.Deserializer;
import org.apache.axis.encoding.Callback;
import org.apache.axis.encoding.CallbackTarget;
-import org.apache.axis.utils.QFault;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.w3c.dom.Element;
@@ -86,7 +85,7 @@
// Fault data
protected String faultClassName = null;
- protected QFault faultCode = null;
+ protected QName faultCode = null;
protected String faultString = null;
protected String faultActor = null;
protected Element[] faultDetails;
@@ -200,10 +199,10 @@
QName qname = context.getQNameFromString((String)value);
if (qname != null) {
//??when would QName make sense, this would be app specific
- faultCode = new QFault(qname);
+ faultCode = qname;
} else {
//?? Where would namespace come from
- faultCode = new QFault("",(String) value);
+ faultCode = new QName("",(String) value);
}
} else if (name.equals(Constants.ELEM_FAULT_STRING)) {
faultString = (String) value;
1.15 +2 -0
xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaImplWriter.java
Index: JavaImplWriter.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaImplWriter.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- JavaImplWriter.java 31 Mar 2002 23:09:34 -0000 1.14
+++ JavaImplWriter.java 2 Apr 2002 22:05:19 -0000 1.15
@@ -190,6 +190,8 @@
pw.print("new java.lang.Byte[0]");
} else if (paramType.equals("java.util.Calendar")) {
pw.print("java.util.Calendar.getInstance()");
+ } else if (paramType.equals("javax.xml.rpc.namespace.QName")) {
+ pw.print("new javax.xml.rpc.namespace.QName(\"\", \"\")");
} else {
pw.print("new " + paramType + "()");
}
1.20 +2 -0
xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaTestCaseWriter.java
Index: JavaTestCaseWriter.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaTestCaseWriter.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- JavaTestCaseWriter.java 31 Mar 2002 23:09:34 -0000 1.19
+++ JavaTestCaseWriter.java 2 Apr 2002 22:05:19 -0000 1.20
@@ -260,6 +260,8 @@
pw.print("new byte[0]");
} else if (paramType.equals("java.util.Calendar")) {
pw.print("java.util.Calendar.getInstance()");
+ } else if (paramType.equals("javax.xml.rpc.namespace.QName")) {
+ pw.print("new javax.xml.rpc.namespace.QName(\"double,
double\", \"toil and trouble\")");
} else if (paramType.endsWith("[]")) {
pw.print("new "
+ JavaUtils.replace(paramType, "[]", "[0]"));
1.11 +6 -0 xml-axis/java/test/encoding/TestDeser2001.java
Index: TestDeser2001.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/encoding/TestDeser2001.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- TestDeser2001.java 1 Apr 2002 20:11:00 -0000 1.10
+++ TestDeser2001.java 2 Apr 2002 22:05:19 -0000 1.11
@@ -8,6 +8,8 @@
import java.util.SimpleTimeZone;
import java.util.TimeZone;
+import javax.xml.rpc.namespace.QName;
+
/**
* Test deserialization of SOAP responses
*/
@@ -116,6 +118,10 @@
public void testHexNull() throws Exception {
deserialize("<result xsi:type=\"xsd:hexBinary\"></result>",
new Hex(""),true);
+ }
+
+ public void testQName() throws Exception {
+ deserialize("<result xsi:type=\"xsd:QName\"
xmlns:qns=\"namespace\">qns:localPart</result>", new QName("namespace", "localPart"),
true);
}
public void testMapWithNils() throws Exception {
1.9 +2 -2 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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- FaultDecode.java 27 Nov 2001 16:57:25 -0000 1.8
+++ FaultDecode.java 2 Apr 2002 22:05:19 -0000 1.9
@@ -62,13 +62,13 @@
import org.apache.axis.AxisFault;
import org.apache.axis.Message;
import org.apache.axis.MessageContext;
-import org.apache.axis.utils.QFault;
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.rpc.namespace.QName;
/**
* This class tests Fault deserialization.
@@ -119,7 +119,7 @@
assertNotNull("Fault should not be null", aFault);
- QFault faultCode = aFault.getFaultCode();
+ QName faultCode = aFault.getFaultCode();
assertNotNull("faultCode should not be null", faultCode);
assertEquals("faultCode should match",
faultCode.getLocalPart(),
1.3 +1 -1 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FaultEncode.java 3 Dec 2001 22:49:24 -0000 1.2
+++ FaultEncode.java 2 Apr 2002 22:05:19 -0000 1.3
@@ -62,13 +62,13 @@
import org.apache.axis.AxisFault;
import org.apache.axis.Message;
import org.apache.axis.MessageContext;
-import org.apache.axis.utils.QFault;
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.rpc.namespace.QName;
/**
* This class tests Fault deserialization.
1.2 +0 -5 xml-axis/java/test/soap/PackageTests.java
Index: PackageTests.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/soap/PackageTests.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PackageTests.java 14 Jan 2002 21:17:47 -0000 1.1
+++ PackageTests.java 2 Apr 2002 22:05:19 -0000 1.2
@@ -2,11 +2,6 @@
import junit.framework.Test;
import junit.framework.TestSuite;
-import test.utils.TestAxisClassLoader;
-import test.utils.TestQName;
-import test.utils.TestQFault;
-import test.utils.TestXMLUtils;
-import test.utils.TestMessages;
/**
*/
1.8 +0 -1 xml-axis/java/test/utils/PackageTests.java
Index: PackageTests.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/utils/PackageTests.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- PackageTests.java 25 Feb 2002 17:37:25 -0000 1.7
+++ PackageTests.java 2 Apr 2002 22:05:19 -0000 1.8
@@ -19,7 +19,6 @@
// suite.addTest(TestOptions.suite()); //comment out for now - this
// class is a mess
suite.addTest(TestQName.suite());
- suite.addTest(TestQFault.suite());
suite.addTest(TestJavaUtils.suite());
suite.addTest(TestXMLUtils.suite());
suite.addTest(TestMessages.suite());
1.12 +1 -35 xml-axis/java/test/utils/TestQName.java
Index: TestQName.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/utils/TestQName.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- TestQName.java 15 Feb 2002 19:41:17 -0000 1.11
+++ TestQName.java 2 Apr 2002 22:05:19 -0000 1.12
@@ -24,14 +24,6 @@
protected void setup() {
}
- public void testQNameDefaultConstructor()
- {
- QName qname = new QName();
- assertTrue("qname not an instance of QName", qname instanceof QName);
- // ?? not really necessary. Compiler won't compile otherwise
- // assertNull("LocalPart was not null", qname.getLocalPart());
- }
-
public void testQName2StringConstructor()
{
QName qname = new QName("rdf","article");
@@ -42,37 +34,16 @@
"article", qname.getLocalPart());
}
- public void testQNameStringElementConstructor()
- {
- String NAMESPACE = "namespace";
- String PREFIX = "prefix";
- String LOCALPART = "localPart";
- String DEFAULTNS = "default";
-
- Document doc = XMLUtils.newDocument();
- Element elem = doc.createElementNS(NAMESPACE, LOCALPART);
- elem.setAttributeNS(Constants.NS_URI_XMLNS, "xmlns:"+PREFIX, NAMESPACE);
- QName qname = new QName(PREFIX + ":" + LOCALPART, elem);
- assertNotNull("qname was null", qname);
- assertEquals("Namespace URI did not match",
- NAMESPACE, qname.getNamespaceURI());
- assertEquals("LocalPart did not match",
- LOCALPART, qname.getLocalPart());
- }
-
public void testToString()
{
QName qname = new QName("PREFIX", "LOCALPART");
assertEquals("qname was not the same as 'PREFIX:LOCALPART', it was: " +
qname.toString(),
"PREFIX:LOCALPART", qname.toString());
-
- qname.setNamespaceURI(null);
- assertEquals("qname was not the same as 'LOCALPART', is was: " +
qname.toString(), "LOCALPART", qname.toString());
}
public void testEquals()
{
- QName qname1 = new QName();
+ QName qname1 = new QName(null, null);
QName qname2 = new QName("PREFIX", "LOCALPART");
QName qname3 = new QName("PREFIX", "LOCALPART");
QName qname4 = new QName("PREFIX", "DIFFLOCALPART");
@@ -99,10 +70,5 @@
QName contrast = new QName("xso", "text");
assertEquals("control hashcode does not equal compare.hashcode",
control.hashCode(), compare.hashCode());
assertTrue("control hashcode is not equivalent to compare.hashcode",
!(control.hashCode() == contrast.hashCode()));
- }
-
- public static void main(String[] args) throws Exception {
- TestQName tester = new TestQName("test");
- tester.testQNameStringElementConstructor();
}
}