Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The AegisDatabinding accepts a Configuration object. The configuration objects sets defaults for type mapping. The properties should be self-explanatory, as they correspond to the usual option attributes of XML schema types and elements. Note that 'extensibleElements' means adding xs:any to the WSDL Complex Type Definition.

The namespaceMap

The AegisDatabinding accepts a Map<String, String> to control the assignment of namespace prefixes. Most application have no interest in the assignment of prefixes. The semantics of XML are concerned with the actual namespace URI or URL strings, not the prefixes. However, there are some cases (such as very basic clients coded in simple languages) in which is it desirable to set up controlled, immutable, prefix mappings. The Map keys are namespaces, and the values are prefixes. Needless to say, both sides of the map have to be unique.

...

Type

XSD Mapping

boolean

XSD boolean

Boolean

XSD boolean

int

XSD int

Integer

XSD int

short

XSD int

Short

XSD int

double

XSD double

Double

XSD double

float

XSD float

Float

XSD float

long

XSD long

Long

XSD long

char

XSD char

Character

XSD char

String

XSD String

java.sql.Date

XSD date-time

java.sql.Time

XSD time

java.util.Calendar

XSD date-time

byte[]

XSD Base64

BigDecimal

XSD Decimal

BigInteger

XSD Integer

org.w3c.Document

XSD Any

org.jdom.Document

XSD Any

org.jdom.Element

XSD Any

javax.xml.transform.source

XSD Any

javax.xml.stream.XMLStreamReader

XSD Any

Object

XSD Any

javax.activation.DataSource

XSD Base64 via MTOM data source type (See org.apache.cxf.argis.type.mtom)

javax.activation.DataHandler

XSD Base64 via MTOM data source type (See org.apache.cxf.argis.type.mtom)

Services that Don't Use Soap 1.1

...

Type

XSD Mapping

boolean

XSD boolean

Boolean

XSD boolean

int

XSD int

Integer

XSD int

short

XSD int

Short

XSD int

double

XSD double

Double

XSD double

float

XSD float

Float

XSD float

long

XSD long

Long

XSD long

char

XSD char

Character

XSD char

String

XSD String

java.sql.Date

XSD date-time

java.sql.Time

XSD time

java.util.Calendar

XSD date-time

byte[]

XSD Base64

BigDecimal

XSD Decimal

BigInteger

XSD Integer

org.w3c.Document

XSD Any

org.jdom.Document

XSD Any

org.jdom.Element

XSD Any

javax.xml.transform.source

XSD Any

javax.xml.stream.XMLStreamReader

XSD Any

Object

XSD Any

javax.activation.DataSource

XSD Base64Base64 via MTOM data source type (See org.apache.cxf.argis.type.mtom)

javax.activation.DataHandlerXSD Base64

Base54 MTOM data source type (See org.apache.cxf.argis.type.mtom)

These services get some additional mappings, as well:

Type

Mapping

javax.xml.datatype.Duration

XSD Duration

javax.xml.datatype.XMLGregorianCalendar

XSD Date

javax.xml.datatype.XMLGregorianCalendar

XSD Time

javax.xml.datatype.XMLGregorianCalendar

XSD gDay

javax.xml.datatype.XMLGregorianCalendar

XSD gMonth

javax.xml.datatype.XMLGregorianCalendar

XSD gMonthDay

javax.xml.datatype.XMLGregorianCalendar

XSD gYear

javax.xml.datatype.XMLGregorianCalendar

XSD gYearMonth

javax.xml.datatype.XMLGregorianCalendar

XSD Date-Time

Customizing Type Mapping

Each of the standard type mappings is a relationship between a Java class object and a subclass of org.apache.xxf.aegis.Type. If you want to add your own class-level mapping, you can implement your own subclasses of Type, and register them against your service URI (or an encoding style URI) in the type mapping registry. Reading the source of the standard objects is required here.

The Type Creators

The type mapping registry maintains a chain of TypeCreator objects. These objects do the work of creating mappings for Java types that are not pre-mapped via the standard types above or custom mappings that you install. The XMLTypeCreator handled mapping files. For historical reasons, the rest of the process is split between the Java5TypeCreator and the DefaultTypeCreator. Historically, XFire supported Java 1.4, so all the code that depended on Java 1.5 (both annotation processing and generic type processing) was quarantined in the Java5TypeCreator.

The creators are arranged in a chain via the AbstractTypeCreator class, which stores a nextCreator. The top creator gets the first run at a method, property, field, or class. It can do the entire mapping, or call the next creator in the chain and modify its results, or simply punt to the next creator in the chain. If you want algorithmic control on the automatic type mapping process, you will want to put your own type creator at the head of the chain.

This is not so easy to do with Spring, as the desired process is to let the DefaultTypeMappingRegistry create the usual chain, and then retrieve and modify it. However, you can achieve this result by copying what the DefaultTypeMappingRegistry does: arrange a chain of your creator followed by XML, Java5, and Default.