The XML Schema to JavaBeansTM Compiler

The Novell exteNd Web Services SDK xsd2java compiler transforms XML Schema into standard JavaBeanTM classes with associated marshalers for conversion between the JavaBeanTM representation and the external XML representation. The marshalers will produce and read XML, which conforms to the defining XML schema. For more information on how to write a schema, please have a look at XML Schema Primer document from W3C.

The xsd2java compiler is used internally by the wsdl2java compiler when processing schema types. This vastly increases developer productivity since JavaBeansTM and marshalers are automatically created for clients that need to invoke a SOAP endpoint. The generated type mappings are automatically compiled into the generated service class, which means that no client programming is required to use them.

The xsd2java compiler supports many commonly encountered schema types and generates appropriate JavaBeansTM depending on the XML Schema definition. It has full implementation of the JAX-RPC 1.1 XML to Java mappings. As an example, the compiler supports the entire UDDI Version 2.0 XML Schema. To find out which schema constructs are supported by the Novell exteNd WSSDK, click here.

The following is an overview of the XML Schema to Java mapping rules provided in xsd2java:

·        The complexTypes, simpleTypes and anonymous types will be mapped to a JavaBeanTM.

·        All the elements and attributes refered by complexTypes will be mapped to JavaBeanTM properties.

·        The JavaBeansTM are not generated any more for simpleTypes. They are mapped as per the JAX_RPC 1.1 specification. Please see below for more details.

·        Choice and group elements are mapped to JavaBeansTM.

·        Any XML Schema type that can not be handled by xsd2java or is missing, will be mapped to java.lang.Object.

·        The xsd2java compiler provides the -validate switch to turn on schema constraint validation.

The xsd2java supports all the built-in types with all the constraints/facets specified by XML Schema. It also supports most of the commonly used schema constructs for defining complexTypes. With the new support for JAX-RPC-1.1 mapping, the simpleType beans are not generated anymore. Instead the simpleTypes are mapped to their most basic types such as Java primitives. Below are samples of code generated from examples.xsd for the JAX-RPC-1.1(default) mappings.

·       simpleType using enumeration

·       complexType from simpleContent

·       complexType using all

·       complexType using sequence

·       complexType derivation by extension

·       complexType using attributeGroup

·       complexType using choice and group

Option to generate the code having APIs similar to that generated by WSDDK 5.0 version is also provided through the –olddatabinding flag. Below are samples of code generated from the same examples.xsd using -olddatabinding.

·        simpleType derived from xsd:string with constraints

·        simpleType derived from xsd:decimal with constraints

·        simpleType derived from another simpleType with constraints

·        simpleType using enumeration

·        simpleType using list

·        simpleType using union

·        complexType from simpleContent

·        complexType using all

·        complexType using sequence

·        complexType derivation by extension

·        complexType using attributeGroup

·        complexType using choice and group

 



Copyright © 2003, 2004 Novell, Inc. All rights reserved. Copyright © 2001, 2002, 2003 SilverStream Software, LLC. All rights reserved.