You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Tom Jordahl <to...@macromedia.com> on 2002/08/07 17:22:28 UTC

Support for XML Schema types in Axis

Hi all,

I am ready to check in support for a bunch of XML Schema types: time, unsignedInt, unsignedShort, unsignedByte, and unsignedLong.  I also plan to add the types gYear and gMonthYear as soon as I can whip them up, with possibly more types later.

How is this getting done?

The types have been implemented in the org.apache.axis.types package.  Each of the classes enforces the restrictions of the XML type they implement.  The Schema type is mapped directly to the corresponding Axis type.  A Serializer/Deserializer is defined for each new Schema type.

We had previously implemented NormalizedString and Token, which were in encoding and have moved to types.

Chris Kowalski contributed the unsigned* types as well as the NormalizedString and Token types.

What is good about this:
 - It make supporting additional Schema types simple.
 - There is no 'lossy' conversion of Schema types to Java types (i.e. unsignedInt -> int)
 - The WSDL generated by these types survives a round-trip from WSDL->Java->WSDL.
 - The semantics of these types are specific and can be enforced by their classes.
 - It is simple to document and understand ("The XML Schema type "time" maps to org.apache.axis.types.Time.")

What isn't so good:
 - We have introduced Axis specific classes that must be used when calling Stubs/Beans generated by our WSDL2Java
 - Dealing with the Axis UnsignedInt class isn't as simple as dealing with Java 'int'


Sam has suggested the idea that Axis should provide a configurable choice of which mappings to use. For instance, if the user wanted the "convenience" mode, unsignedInt could be mapped to int, time would map to Calendar, etc.  They could choose "Schema" mode, where the Axis types are used.  Or we could somehow let the user define class mappings themselves.  I am not opposed to this, but I do think it would make the system more complicated, albeit more flexible.  I do not think there is anything in this submit that would prevent a system like the above from being implemented, but I would argue that the "Schema" mode, where Axis schema types are used, should be the default.

I plan on checking in the new type support after lunch (EDT) unless there are serious objections.

Comments?

--
Tom Jordahl
Macromedia Server Development