WSDL has no deal with xjb. xjb is for xjc compiler passed as -b parameter.
i.e.
xjc -b <file>
documentation: Customizing JAXB Binding
if you use Maven plugins to generate your JAXB Java classes any of them have Binding configuration i.e.
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<configuration>
<defaultOptions>
<bindingFiles>
<bindingFile>${project.interfaces.basedir}Configuration/Bindings/common-binding.xjb</bindingFile>
</bindingFiles>
or
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<configuration>
<schemaDirectory>${basedir}/src/main/resources/XMLSchema</schemaDirectory>
<bindingDirectory>${basedir}/src/main/resources/Bindings</bindingDirectory>
</configuration>
and so on...
xjb for it is very simple:
<jaxb:bindings xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
jaxb:extensionBindingPrefixes="xjc">
<jaxb:globalBindings>
<jaxb:serializable uid="1" />
<jaxb:javaType name="java.util.Calendar" xmlType="xsd:dateTime"
parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime"
printMethod="javax.xml.bind.DatatypeConverter.printDateTime" />
<jaxb:javaType name="java.util.Calendar" xmlType="xsd:date"
parseMethod="javax.xml.bind.DatatypeConverter.parseDate" printMethod="javax.xml.bind.DatatypeConverter.printDate" />
<jaxb:javaType name="java.util.Calendar" xmlType="xsd:time"
parseMethod="javax.xml.bind.DatatypeConverter.parseTime" printMethod="javax.xml.bind.DatatypeConverter.printTime" />
</jaxb:globalBindings>
as you can see it defines conversions from xsd:dateTime, xsd:date and xsd:time types to java.util.Calendar.
I do not recommend to use java.util.Date. There are many troubles with Date handling (especially with different timeZones).
It is better to use java.util.Calendar. Calendar is much easier to handle and default converter implementation is there in JDK:
javax.xml.bind.DatatypeConverter
But, if you still want to use java.Util.Date you need to have your own small converter with two static methods "parse" and "print" and then set it in xjb. i.e.
public class MyDateConverter {
public static java.util.Date parse(String xmlDateTime) {
return javax.xml.bind.DatatypeConverter.parseDateTime(xmlDateTime).getTime();
}
public static String print(Date javaDate) {
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(javaDate.getTime());
return javax.xml.bind.DatatypeConverter.printDateTime(calendar);
}
}
your conversions in xjb will look like:
<jaxb:javaType name="java.util.Date" xmlType="xsd:dateTime"
parseMethod="MyDatatypeConverter.parse"
printMethod="MyDatatypeConverter.print" />