Axis serializes xsd:int as multiRef ----------------------------------- Key: AXIS-1886 URL: http://issues.apache.org/jira/browse/AXIS-1886 Project: Axis Type: Bug Components: Serialization/Deserialization Versions: 1.2RC3 Environment: every environment Reporter: Daniel David Schäfer
Hi all, I found a strange behaviour of axis when it serializes nillable bean-members declared as xsd:int. I think, it is absolutely overkill to encode a single integer to a chunk like this: <multiRef id="id5" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1111054002</multiRef> I found a routine called isPrimitive() that decides if a given object should be serialized as an object-reference (multiRef at the end of the soap-body) or directly into the data-structure where it is located. This routine calls obj.getClass().isPrimitive() which is unfortunately never true with any java-object but only with class-objects like Integer.TYPE (which is the type of int and not of java.lang.Integer). So I provided a little patch that returns true for isPrimitive if the given object is of a subtype of java.lang.Number (like Integer, Float, etc.). bye Daniel =================================================================== RCS file: /usr/local/cvsroot/dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java 2005/03/17 13:01:38 1.1 +++ dev_projects/axis12/src/org/apache/axis/encoding/SerializationContext.java 2005/03/17 13:03:05 1.2 @@ -606,9 +606,13 @@ public boolean isPrimitive(Object value) { if (value == null) return true; - + + if(value instanceof java.lang.Number) { + return true; + } + Class javaType = value.getClass(); - + if (javaType.isPrimitive()) return true; if (javaType == String.class) return true; -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira