This rule flags references to any of the following schema types:
http://www.w3.org/2001/XMLSchema:duration, http://www.w3.org/2001/XMLSchema:dateTime,
http://www.w3.org/2001/XMLSchema:time, http://www.w3.org/2001/XMLSchema:date,
http://www.w3.org/2001/XMLSchema:gYearMonth, http://www.w3.org/2001/XMLSchema:gYear, NAMESPACE:gMonth,
http://www.w3.org/2001/XMLSchema:gDay
These schema types and their JAX-RPC related Java types
java.util.String
and
java.util.Calendar
are not supported by JAX-WS.
Migration to JAX-WS and JAXB will require the
use of those schema types with the supported Java type
javax.xml.datatype.XMLGregorianCalendar
instead.
An example of a JAX-RPC Calendar class looks like:
import java.util.Calendar;
import java.rmi.RemoteException;
public Calendar calculateShippingDate(Calendar requestedDate) throws RemoteException; {
// Set the date to the date that was sent to us and add 7 days.
requestedDate.add(java.util.Calendar.DAY_OF_MONTH, 7);
// . . .
return requestedDate;
}
An example of a JAX-WS XMLGregorianCalendar class looks like:
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.datatype.DatatypeConfigurationException;
public XMLGregorianCalendar calculateShippingDate(
XMLGregorianCalendar requestedDate) {
try {
// Create a data type factory.
DatatypeFactory df = DatatypeFactory.newInstance();
// Set the date to the date that was sent to us and
add 7 days.
Duration duration = df.newDuration("P7D");
requestedDate.add(duration);
} catch (DatatypeConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// . . .
return requestedDate;
}
As you can see from the example above the input parameter has changes from type
java.util.Calendar
to
javax.xml.datatype.XMLGregorianCalendar
.
This is because the WSDL specified these parameters to be of type,
xsd:dateTime
, JAX-RPC maps this data type to
java.util.Calendar
, while JAX-WS and JAXB maps it to
javax.xml.datatype.XMLGregorianCalendar
.