I've attached a patch for this. I've also attached a patch for the
interop sample deployment descriptor, which was using empty namespaces
with a prefix [ xmlns:x="" ] which isn't valid, and Xerces (2.0.1) was
throwing an error.
Cheers
Simon
www.pocketsoap.com
On Sun, 9 Jun 2002 01:13:53 +0600, in soap you wrote:
>Hi Simon,
>
>Was this in the 2.3 codebase? If so I agree this'll be a big
>problem and probably sufficient cause for a 2.3.1 to be
>released ASAP.
>
>I agree it needs to be fixed right to work with both XSD
>versions.
>
>Thanks!
>
>Sanjiva.
>
>----- Original Message -----
>From: "Simon Fell" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Saturday, June 08, 2002 8:45 AM
>Subject: xsi:null handling
>
>
>> I noticed that Apache SOAP always serializes NULLs with
>> xsi:null="true", the problem is that for the 2001 schema version there
>> is no null attribute it got renamed to nil.
>>
>> The quick fix is to change the definition of ATTR_NULL in
>> constants.java, however it looks like the code supports both 1999 and
>> 2001 schema, so really it needs to pick the correct attribute name
>> based on the schema version in use.
>>
>> This will be a significant interop issue for people using nulls
>> between Apache and non-Apache toolkits.
>>
>> Cheers
>> Simon
>> www.pocketsoap.com
Index: DeploymentDescriptor.xml
===================================================================
RCS file: /home/cvspublic/xml-soap/java/samples/interop/DeploymentDescriptor.xml,v
retrieving revision 1.12
diff -u -r1.12 DeploymentDescriptor.xml
--- DeploymentDescriptor.xml 31 Jan 2002 17:42:28 -0000 1.12
+++ DeploymentDescriptor.xml 9 Jun 2002 18:49:28 -0000
@@ -9,30 +9,30 @@
<isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultListener>
- <isd:mappings>
+ <isd:mappings xmlns="">
<isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:x="" qname="x:inputInteger"
+ qname="inputInteger"
xml2JavaClassName="org.apache.soap.encoding.soapenc.IntDeserializer"/>
<isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:x="" qname="x:inputFloat"
+ qname="inputFloat"
xml2JavaClassName="org.apache.soap.encoding.soapenc.FloatDeserializer"/>
<isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:x="" qname="x:inputString"
+ qname="inputString"
xml2JavaClassName="org.apache.soap.encoding.soapenc.StringDeserializer"/>
<isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:x="" qname="x:inputStruct"
+ qname="inputStruct"
xml2JavaClassName="samples.interop.DataSerializer"/>
<isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:x="" qname="x:inputIntegerArray"
+ qname="inputIntegerArray"
xml2JavaClassName="org.apache.soap.encoding.soapenc.ArraySerializer"/>
<isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:x="" qname="x:inputFloatArray"
+ qname="inputFloatArray"
xml2JavaClassName="org.apache.soap.encoding.soapenc.ArraySerializer"/>
<isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:x="" qname="x:inputStringArray"
+ qname="inputStringArray"
xml2JavaClassName="org.apache.soap.encoding.soapenc.ArraySerializer"/>
<isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:x="" qname="x:inputStructArray"
+ qname="inputStructArray"
xml2JavaClassName="org.apache.soap.encoding.soapenc.ArraySerializer"/>
<isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
@@ -46,24 +46,24 @@
xml2JavaClassName="org.apache.soap.encoding.soapenc.ArraySerializer"/>
<isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:x="" qname="x:inputBase64"
+ qname="inputBase64"
xml2JavaClassName="org.apache.soap.encoding.soapenc.Base64Serializer"/>
<isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:x="" qname="x:inputHexBinary"
+ qname="inputHexBinary"
xml2JavaClassName="org.apache.soap.encoding.soapenc.HexDeserializer"/>
<isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:x="" qname="x:inputDate"
+ qname="inputDate"
xml2JavaClassName="org.apache.soap.encoding.soapenc.DateSerializer"/>
<isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:x="" qname="x:inputDecimal"
+ qname="inputDecimal"
xml2JavaClassName="org.apache.soap.encoding.soapenc.DecimalDeserializer"/>
<isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:x="" qname="x:inputBoolean"
+ qname="inputBoolean"
xml2JavaClassName="org.apache.soap.encoding.soapenc.BooleanDeserializer"/>
<isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:x="" qname="x:inputMap"
+ qname="inputMap"
xml2JavaClassName="org.apache.soap.encoding.soapenc.HashtableSerializer"/>
</isd:mappings>
</isd:service>
Index: org/apache/soap/Constants.java
===================================================================
RCS file: /home/cvspublic/xml-soap/java/src/org/apache/soap/Constants.java,v
retrieving revision 1.24
diff -u -r1.24 Constants.java
--- org/apache/soap/Constants.java 10 Nov 2001 02:28:09 -0000 1.24
+++ org/apache/soap/Constants.java 9 Jun 2002 18:31:55 -0000
@@ -165,6 +165,7 @@
public static final String ATTR_MUST_UNDERSTAND = "mustUnderstand";
public static final String ATTR_TYPE = "type";
public static final String ATTR_NULL = "null";
+ public static final String ATTR_NIL = "nil";
public static final String ATTR_ARRAY_TYPE = "arrayType";
public static final String ATTR_REFERENCE = "href";
public static final String ATTR_ID = "id";
Index: org/apache/soap/encoding/soapenc/SoapEncUtils.java
===================================================================
RCS file:
/home/cvspublic/xml-soap/java/src/org/apache/soap/encoding/soapenc/SoapEncUtils.java,v
retrieving revision 1.9
diff -u -r1.9 SoapEncUtils.java
--- org/apache/soap/encoding/soapenc/SoapEncUtils.java 29 May 2002 18:45:43 -0000
1.9
+++ org/apache/soap/encoding/soapenc/SoapEncUtils.java 9 Jun 2002 18:31:56 -0000
@@ -164,7 +164,7 @@
Constants.NS_URI_CURRENT_SCHEMA_XSI, sink);
String elementTypeNSPrefix = nsStack.getPrefixFromURI(
elementType.getNamespaceURI(), sink);
-
+
sink.write(' ' + xsiNSPrefix + ':' + Constants.ATTR_TYPE + "=\"" +
elementTypeNSPrefix + ':' +
elementType.getLocalPart() + '\"');
@@ -198,18 +198,25 @@
if (isNull)
{
- sink.write(' ' + xsiNSPrefix + ':' + Constants.ATTR_NULL + "=\"" +
+ sink.write(' ' + xsiNSPrefix + ':' + nilName() + "=\"" +
Constants.ATTRVAL_TRUE + "\"/");
}
sink.write('>');
}
+ private static String nilName()
+ {
+ return Constants.NS_URI_CURRENT_SCHEMA_XSI ==
+ Constants.NS_URI_2001_SCHEMA_XSI ?
+ Constants.ATTR_NIL : Constants.ATTR_NULL ;
+ }
+
public static boolean isNull(Element element)
{
String nullValue = DOMUtils.getAttributeNS(element,
Constants.NS_URI_CURRENT_SCHEMA_XSI,
- Constants.ATTR_NULL);
+ nilName() );
return nullValue != null && decodeBooleanValue(nullValue);
}