Hi,
I have a web service that retuns a DateTime datatype element :
<xsd:element name=“dateEffect” type=“xsd:dateTime”/>
In some cases, this web service can return a “dateEffect” = null.
When I try my web service in SoapUI, this works well without error :
<request>
<dateEffect/> --> null value
</request>
Testing within webMethods, it works too.
Testing within a web browser, it works too.
but when I try to call it with a Java-CXF calls, I obtain the error below.
The CXF generator transforms the dateTime element in XMLGregorianCalendar :
@XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar dateFinEffet;
org.apache.cxf.interceptor.Fault: Unmarshalling Error:
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:882)
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:703)
at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:160)
....
Caused by: java.lang.IllegalArgumentException:
at com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl$Parser.parseAndSetYear(XMLGregorianCalendarImpl.java:2887)
at com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl$Parser.parse(XMLGregorianCalendarImpl.java:2773)
at com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl.<init>(XMLGregorianCalendarImpl.java:435)
at com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl.newXMLGregorianCalendar(DatatypeFactoryImpl.java:536)
at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$12.parse(RuntimeBuiltinLeafInfoImpl.java:586)
... 35 more
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Unmarshalling Error:
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:159)
at com.sun.proxy.$Proxy34.getContratsRentes(Unknown Source)
at com.mif.simuws.tests.contratsrentes.WsContratsRentesPortType_MifMetierSynchroneWsProviderWsContratsRentesPort_Client.main(WsContratsRentesPortType_MifMetierSynchroneWsProviderWsContratsRentesPort_Client.java:56)
...
Caused by: java.lang.IllegalArgumentException:
at com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl$Parser.parseAndSetYear(XMLGregorianCalendarImpl.java:2887)
at com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl$Parser.parse(XMLGregorianCalendarImpl.java:2773)
at com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl.<init>(XMLGregorianCalendarImpl.java:435)
at com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl.newXMLGregorianCalendar(DatatypeFactoryImpl.java:536)
at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$12.parse(RuntimeBuiltinLeafInfoImpl.java:586)
... 35 more
Would you have any idea to avoid this error please ?