Development tools : Web services tooling : Limitations and known issues : Data type mapping issue
  
Data type mapping issue
Background
In self defined operation generation, we recommend explicit wsdl type mapping. If user define anonymous simple type, we support following types mapping wsdl to UDTT type: boolean, int, long, byte, short, float, double, duration, integer, decimal, base64Binary, and string.
Issue details
In XSD for JAX-WS, developers could have 2 options to bound a customized, simple type to a data element.
<element name="A_Element" type="tns:MyString"/>
  <xs:simpleType name="My String">
  <xs:restriction base="xs:string">
  <xs:minLength value="5"/>
  </xs:restriction>
</sx:simpleType>
UDTT Web services tool could get the customized name (MyString). So developers could define the type mapping rule from XSD 'MyString' to UDTT 'String'.
<element name="A_Element">
  <xs:simpleType>
  <xs:restiction base="xs"string">
  <xs:minLength value="5"/>
  <xs:restriction>
  </xs:simpleType>
</element>
There is no name for the customized type. So we could only read the value of the 'base' attribute which is 'string' here. For the type mapping, developers should define the type mapping between XSD 'string' to UDTT 'String'.
But, for the anonymous type style, we could not read the base attribute for any kind of types from the API provided by JDK wsimport tool. The exceptions occurs in XSD types 'time', 'date' and 'dateTime'. Because these three types are not treated as simple type in the WSDL model. So, for these three types, users could not use anonymous style for them.
Besides, there is a XSD type named 'hexBinary' which will be derived into byte[] in Java world. But in JAX-WS runtime and the WSDL model of wsimport tool, the 'hexBinary' type is adapted into 'string' type. So we would get 'string' from the 'base' attribute, but actually it may be a 'hexBinary'. If developers need to use byte array, they could use XSD 'base64Binary'.
Impact
For the type mapping between simple XSD type to UDTT type, it works all the time if developers explicitly define the type and bound it with an element. But if developers defined an anonymous type (base attribute to UDTT type), the type mapping only works for the following types: boolean, int, long, byte, short, float, double, duration, integer, decimal, base64Binary, and string. For example, the type date, time, dateTime are not supported.
Workaround
For example, there is a special type 'hexBinary'. After WSDL import, it will be derived into a Java type as 'byte[]'. But in Web services runtime, it seems the byte array defined with 'hexBinary' will be delegated as type 'string'. So, in the wsimport tool, we will get 'string' as the base attribute even though we have defined it as 'hexBinary'. Therefore, we suggest to remove the type mapping between 'hexBinary' to 'ByteArray'. If developer needs to define the type mapping to UDTT 'ByteArray', he should use the type 'base64Binary' in WSDL.
Go up to
Limitations and known issues