Monday, December 31, 2012

XML-to-Java mappings used by JAX-WS

In this post i am not going to discuss more details on XML-to-Java object mapping used by JAX-WS.

I will describe, when JAX-WS maps, XML element or attribute declaration to Java primitive wrapper class. Most of the time, during designing/writing schema definition(XSD) for web service, we are not thinking about that XML-to-Java conversion, hence later on it will become a issue while debugging web service.

There are mainly three conditions when XML element or attribute declaration converted to Java primitive wrapper class used by JAX-WS.

  1. When element declaration contains "minCccurs=0" attribute.
  2. When element declaration contains "nillable=true" attribute.
  3. When attribute declaration contains "use=optional" attribute. 
Examples:





In the above element/attribute declaration "short/boolean" primitive datatype is converted to "short/boolean" primitive wrapper class.

No comments:

Post a Comment