Ton,
Glad to hear it won't make things worse!
I set test.functional.fail to "no" so that I could get through the tests,
and now I know that there are:
7 Failures in wsdl.types.comprehensive_service.TypeTestServiceTestCase
1 Failure in wsdl.types.VerifyTestCase
I'm working on tracking this one down.
Does anyone else see these?
Matt Seibert [EMAIL PROTECTED]
IBM External: (512) 838-3656 Internal: 678-3656
Let me note about this check in that I was able to successfully run all
tests after making these changes with a source tree from I believe
yesterday
morning.
So I know this wont make things any worse.
--
Tom Jordahl
Macromedia Server Development
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 19, 2002 4:25 PM
To: [EMAIL PROTECTED]
Subject: cvs commit: xml-axis/java/src/org/apache/axis/description
FieldDesc.java
tomj 2002/09/19 13:25:13
Modified: java/test/wsdl/extensibility build.xml
ExtensibilityQueryTestCase.java server-deploy.wsdd
java/test/encoding TestBeanDeser2.java TestDeser.java
java/src/org/apache/axis/wsdl/toJava
JavaBeanHelperWriter.java
java/src/org/apache/axis/encoding/ser BeanDeserializer.java
BeanSerializer.java
java/src/org/apache/axis/description FieldDesc.java
Log:
Fix bug 12339 - xsd:date uses Calendar Serializer/Deserializer instead of
Date
- Enhanced the FieldDesc class to have getter/setter for xmlType QName.
- JavaBeanHelper will set this element for fields (but not array types).
- The BeanDeserializer now uses the xmlType in the FieldDesc when looking
up the correct deserializer for the bean element.
- The BeanSerializer passes the xmlType in preference to looking up the
QName of the java class. This prevents the wrong serializer from
getting
used if a class is mapped to more than one XML type (i.e.
java.utils.Date).
Test fixes and improvements:
- Fix up the namespaces (which now count) in Deserailization test
- Added a few new assertions to TestBeanDeser2.java
Extensibility WSDL test:
- Correct type mappings in config WSDD and client
- Improve the way we call AdminClient and print a reasonable error
- Copy the Extensibility test server-config.wsdd to the work directory
Revision Changes Path
1.8 +1 -0 xml-axis/java/test/wsdl/extensibility/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/xml-axis/java/test/wsdl/extensibility/build.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- build.xml 10 Sep 2002 16:06:53 -0000 1.7
+++ build.xml 19 Sep 2002 20:25:12 -0000 1.8
@@ -74,6 +74,7 @@
<fileset dir="${axis.home}/test/wsdl/extensibility">
<include name="*TestCase.java"/>
<include name="*Impl.java"/>
+ <include name="server-deploy.wsdd"/>
</fileset>
</copy>
1.13 +30 -2
xml-axis/java/test/wsdl/extensibility/ExtensibilityQueryTestCase.java
Index: ExtensibilityQueryTestCase.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/test/wsdl/extensibility/ExtensibilityQueryTestCase.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ExtensibilityQueryTestCase.java 18 Aug 2002 14:19:50 -0000
1.12
+++ ExtensibilityQueryTestCase.java 19 Sep 2002 20:25:12 -0000
1.13
@@ -9,6 +9,7 @@
import org.apache.axis.EngineConfiguration;
import org.apache.axis.AxisEngine;
+import org.apache.axis.utils.Options;
import org.apache.axis.message.MessageElement;
import org.apache.axis.client.AdminClient;
import org.apache.axis.encoding.TypeMappingRegistry;
@@ -21,6 +22,10 @@
import javax.xml.rpc.encoding.TypeMapping;
import javax.xml.namespace.QName;
import java.util.Calendar;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.FileNotFoundException;
public class ExtensibilityQueryTestCase extends junit.framework.TestCase
{
public ExtensibilityQueryTestCase(String name) {
@@ -56,11 +61,15 @@
bookQuery.setBookQuery(book);
MessageElement el = new MessageElement("foo", "Bar",
bookQuery);
expression.set_any(new MessageElement [] { el });
+ // call the operation
ExtensibilityType any = binding.query(expression);
+ // validate results
MessageElement [] anyContent = any.get_any();
assertEquals(1, anyContent.length);
QueryResultElement resEl = (QueryResultElement
)anyContent[0].getObjectValue();
+ assertNotNull("QueryResultElement back from
anyContent[0].getObjectValue()", resEl);
ResultListType result = resEl.getResultList();
+ assertNotNull("ResultListType back from getResultList()",
result);
QueryResultType[] queryResult = result.getResult();
assertTrue(queryResult.length == 2);
isValid(queryResult[0], "Computer Science", "The Grid");
@@ -86,7 +95,7 @@
TypeMapping mapping = registry.createTypeMapping();
addBeanMapping(mapping, "FindBooksQueryExpressionElement",
FindBooksQueryExpressionElement.class);
addBeanMapping(mapping, "BookType", BookType.class);
- addBeanMapping(mapping, "resultList", ResultListType.class);
+ addBeanMapping(mapping, "ResultListType", ResultListType.class);
addBeanMapping(mapping, "QueryResultType",
QueryResultType.class);
addBeanMapping(mapping, "QueryResultElement",
QueryResultElement.class);
registry.register("",mapping);
@@ -103,7 +112,26 @@
}
private void deployServer() {
- AdminClient.main(new String[] {
"test/wsdl/extensibility/server-deploy.wsdd" });
+ final String INPUT_FILE = "server-deploy.wsdd";
+
+ InputStream is = getClass().getResourceAsStream(INPUT_FILE);
+ if (is == null) {
+ // try current directory
+ try {
+ is = new FileInputStream(INPUT_FILE);
+ } catch (FileNotFoundException e) {
+ is = null;
+ }
+ }
+ assertNotNull("Unable to find " + INPUT_FILE + ". Make sure it
is on the classpath or in the current directory.", is);
+ AdminClient admin = new AdminClient();
+ try {
+ Options opts = new Options( null );
+ opts.setDefaultURL("
http://localhost:8080/axis/services/AdminService");
+ admin.process(opts, is);
+ } catch (Exception e) {
+ assertTrue("Unable to deploy " + INPUT_FILE + ". ERROR: " +
e, false);
+ }
}
}
1.6 +1 -1
xml-axis/java/test/wsdl/extensibility/server-deploy.wsdd
Index: server-deploy.wsdd
===================================================================
RCS file:
/home/cvs/xml-axis/java/test/wsdl/extensibility/server-deploy.wsdd,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- server-deploy.wsdd 16 Aug 2002 11:07:10 -0000
1.5
+++ server-deploy.wsdd 19 Sep 2002 20:25:12 -0000
1.6
@@ -63,7 +63,7 @@
/>
<typeMapping
- qname="query:bookQuery"
+ qname="query:BookType"
type="java:test.wsdl.extensibility.BookType"
serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
1.2 +1 -0 xml-axis/java/test/encoding/TestBeanDeser2.java
Index: TestBeanDeser2.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/encoding/TestBeanDeser2.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestBeanDeser2.java 28 Jun 2002 12:36:51 -0000
1.1
+++ TestBeanDeser2.java 19 Sep 2002 20:25:12 -0000
1.2
@@ -124,6 +124,7 @@
"</multiRef>";
test.encoding.beans.SbTravelRequest travelRequest =
(test.encoding.beans.SbTravelRequest) deserialize(response);
+ assertNotNull("supPliers array missing",
travelRequest.supPliers);
assertTrue(travelRequest.supPliers.length==1);
assertTrue(travelRequest.supPliers[0].searchType.intValue()==0);
assertTrue(travelRequest.supPliers[0].supplierCode.equals("SC**"));
1.40 +10 -10 xml-axis/java/test/encoding/TestDeser.java
Index: TestDeser.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/encoding/TestDeser.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- TestDeser.java 28 Jun 2002 06:17:55 -0000 1.39
+++ TestDeser.java 19 Sep 2002 20:25:12 -0000 1.40
@@ -50,7 +50,7 @@
"<soap:Envelope " +
"xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"
" +
"xmlns:soapenc=\"
http://schemas.xmlsoap.org/soap/encoding/\" " +
- "xmlns:me=\"urn:me\" " +
+ "xmlns:me=\"http://soapinterop.org/xsd\" " +
"xmlns:xsi=\"" + NS_XSI + "\" " +
"xmlns:xsd=\"" + NS_XSD + "\">\n" +
"<soap:Body>\n" +
@@ -66,33 +66,33 @@
tm.setSupportedEncodings(new String[]
{Constants.URI_DEFAULT_SOAP_ENC});
tmr.register(Constants.URI_DEFAULT_SOAP_ENC, tm);
tm.register(java.lang.String[].class,
- new QName("urn:me", "ArrayOfString"),
+ new QName("http://soapinterop.org/xsd",
"ArrayOfString"),
new
org.apache.axis.encoding.ser.ArraySerializerFactory(),
new
org.apache.axis.encoding.ser.ArrayDeserializerFactory());
tm.register(java.lang.Object[].class,
- new QName("urn:me", "ArrayOfObject"),
+ new QName("http://soapinterop.org/xsd",
"ArrayOfObject"),
new
org.apache.axis.encoding.ser.ArraySerializerFactory(),
new
org.apache.axis.encoding.ser.ArrayDeserializerFactory());
tm.register(samples.echo.SOAPStruct.class,
- new QName("urn:me", "SOAPStruct"),
+ new QName("http://soapinterop.org/xsd",
"SOAPStruct"),
new
org.apache.axis.encoding.ser.BeanSerializerFactory(
samples.echo.SOAPStruct.class,
- new QName("urn:me", "SOAPStruct")),
+ new QName("http://soapinterop.org/xsd",
"SOAPStruct")),
new
org.apache.axis.encoding.ser.BeanDeserializerFactory(
samples.echo.SOAPStruct.class,
- new QName("urn:me", "SOAPStruct")));
+ new QName("http://soapinterop.org/xsd",
"SOAPStruct")));
tm.register(samples.echo.SOAPStruct[].class,
- new QName("urn:me", "ArrayOfSOAPStruct"),
+ new QName("http://soapinterop.org/xsd",
"ArrayOfSOAPStruct"),
new
org.apache.axis.encoding.ser.ArraySerializerFactory(),
new
org.apache.axis.encoding.ser.ArrayDeserializerFactory());
tm.register(samples.echo.SOAPStructStruct.class,
- new QName("urn:me", "SOAPStructStruct"),
+ new QName("http://soapinterop.org/xsd",
"SOAPStructStruct"),
new
org.apache.axis.encoding.ser.BeanSerializerFactory(
samples.echo.SOAPStructStruct.class,
- new QName("urn:me", "SOAPStructStruct")),
+ new QName("http://soapinterop.org/xsd",
"SOAPStructStruct")),
new
org.apache.axis.encoding.ser.BeanDeserializerFactory(
samples.echo.SOAPStructStruct.class,
- new QName("urn:me", "SOAPStructStruct")));
+ new QName("http://soapinterop.org/xsd",
"SOAPStructStruct")));
}
/**
1.24 +19 -7
xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaBeanHelperWriter.java
Index: JavaBeanHelperWriter.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaBeanHelperWriter.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- JavaBeanHelperWriter.java 18 Sep 2002 19:14:12 -0000
1.23
+++ JavaBeanHelperWriter.java 19 Sep 2002 20:25:12 -0000
1.24
@@ -60,6 +60,7 @@
import java.util.Vector;
import javax.xml.namespace.QName;
+import javax.xml.rpc.holders.BooleanHolder;
import org.apache.axis.utils.Messages;
@@ -236,10 +237,12 @@
if (attributes != null) {
for (int i = 0; i < attributes.size(); i += 2) {
+ TypeEntry te = (TypeEntry) attributes.get(i);
QName attrName = (QName) attributes.get(i + 1);
String attrLocalName = attrName.getLocalPart();
String fieldName =
Utils.xmlNameToJava(attrLocalName);
fieldName = getAsFieldName(fieldName);
+ QName attrXmlType = te.getQName();
pw.print(" ");
if (!wroteFieldType) {
pw.print("org.apache.axis.description.FieldDesc
");
@@ -247,10 +250,10 @@
}
pw.println("field = new
org.apache.axis.description.AttributeDesc();");
pw.println(" field.setFieldName(\"" +
fieldName + "\");");
- pw.print(" field.setXmlName(");
- pw.print("new javax.xml.namespace.QName(\"");
- pw.print(attrName.getNamespaceURI() + "\", \"");
- pw.println(attrName.getLocalPart() + "\"));");
+ pw.println(" field.setXmlName(" +
Utils.getNewQName(attrName) + ");");
+ if (attrXmlType != null) {
+ pw.println(" field.setXmlType(" +
Utils.getNewQName(attrXmlType) + ");");
+ }
pw.println(" typeDesc.addFieldDesc(field);");
}
}
@@ -267,6 +270,14 @@
String fieldName =
Utils.xmlNameToJava(elemLocalName);
fieldName = getAsFieldName(fieldName);
QName xmlName = elem.getName();
+
+ // Some special handling for arrays
+ QName xmlType = elem.getType().getQName();
+ if (xmlType != null &&
xmlType.getLocalPart().indexOf("[") > 0) {
+ // Skip array types, because they are special
+ xmlType = null;
+ }
+
pw.print(" ");
if (!wroteFieldType) {
pw.print("org.apache.axis.description.FieldDesc
");
@@ -274,9 +285,10 @@
}
pw.println("field = new
org.apache.axis.description.ElementDesc();");
pw.println(" field.setFieldName(\"" +
fieldName + "\");");
- pw.print( " field.setXmlName(new
javax.xml.namespace.QName(\"");
- pw.println(xmlName.getNamespaceURI() + "\", \"" +
- xmlName.getLocalPart() + "\"));");
+ pw.println(" field.setXmlName(" +
Utils.getNewQName(xmlName) + ");");
+ if (xmlType != null) {
+ pw.println(" field.setXmlType(" +
Utils.getNewQName(xmlType) + ");");
+ }
if (elem.getMinOccursIs0()) {
pw.println("
field.setMinOccursIs0(true);");
}
1.54 +8 -0
xml-axis/java/src/org/apache/axis/encoding/ser/BeanDeserializer.java
Index: BeanDeserializer.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/BeanDeserializer.java,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- BeanDeserializer.java 18 Sep 2002 16:10:35 -0000
1.53
+++ BeanDeserializer.java 19 Sep 2002 20:25:12 -0000
1.54
@@ -56,6 +56,7 @@
import org.apache.axis.Constants;
import org.apache.axis.description.TypeDesc;
+import org.apache.axis.description.FieldDesc;
import org.apache.axis.encoding.DeserializationContext;
import org.apache.axis.encoding.Deserializer;
import org.apache.axis.encoding.DeserializerImpl;
@@ -189,6 +190,7 @@
throws SAXException
{
BeanPropertyDescriptor propDesc = null;
+ FieldDesc fieldDesc = null;
String encodingStyle =
context.getMessageContext().getEncodingStyle();
boolean isEncoded = Constants.isSOAP_ENC(encodingStyle);
@@ -206,6 +208,7 @@
String fieldName =
typeDesc.getFieldNameForElement(elemQName,
isEncoded);
propDesc =
(BeanPropertyDescriptor)propertyMap.get(fieldName);
+ fieldDesc = typeDesc.getFieldByName(fieldName);
}
if (propDesc == null) {
@@ -255,6 +258,11 @@
QName childXMLType = context.getTypeFromXSITypeAttr(namespace,
localName,
attributes);
+
+ // If no xsi:type, check the meta-data for the field
+ if (childXMLType == null && fieldDesc != null) {
+ childXMLType = fieldDesc.getXmlType();
+ }
// Get Deserializer for child, default to using DeserializerImpl
Deserializer dSer = getDeserializer(childXMLType,
propDesc.getType(),
1.57 +8 -1
xml-axis/java/src/org/apache/axis/encoding/ser/BeanSerializer.java
Index: BeanSerializer.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/BeanSerializer.java,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- BeanSerializer.java 18 Sep 2002 16:10:35 -0000
1.56
+++ BeanSerializer.java 19 Sep 2002 20:25:12 -0000
1.57
@@ -161,6 +161,7 @@
if (propName.equals("class"))
continue;
QName qname = null;
+ QName xmlType = null;
boolean isOmittable = false;
// If we have type metadata, check to see what we're
doing
@@ -184,6 +185,7 @@
qname = field.getXmlName();
}
isOmittable = field.isMinOccursIs0();
+ xmlType = field.getXmlType();
}
}
@@ -193,6 +195,11 @@
qname = new QName("", propName);
}
+ if (xmlType == null) {
+ // look up the type QName using the class
+ xmlType =
context.getQNameForClass(propertyDescriptor[i].getType());
+ }
+
// Read the value from the property
if(propertyDescriptor[i].isReadable()) {
if (!propertyDescriptor[i].isIndexed()) {
@@ -210,7 +217,7 @@
context.serialize(qname,
null,
propValue,
-
context.getQNameForClass(propertyDescriptor[i].getType()),
+ xmlType,
true,
null);
} else {
1.7 +14 -0
xml-axis/java/src/org/apache/axis/description/FieldDesc.java
Index: FieldDesc.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/description/FieldDesc.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- FieldDesc.java 21 Aug 2002 18:48:43 -0000 1.6
+++ FieldDesc.java 19 Sep 2002 20:25:13 -0000 1.7
@@ -126,6 +126,20 @@
}
/**
+ * Returns the XML type (e.g. xsd:string) for this field
+ */
+ public QName getXmlType() {
+ return xmlType;
+ }
+
+ /**
+ * Returns the XML type (e.g. xsd:string) for this field
+ */
+ public void setXmlType(QName xmlType) {
+ this.xmlType = xmlType;
+ }
+
+ /**
* Check if this is an element or an attribute.
*
* @return true if this is an ElementDesc, or false if an
AttributeDesc