IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.



#Automation


#Applicationintegration
#webMethods
#Integration
 View Only
  • 1.  Problem with dateTime, unmarshalling error

    Posted 04/11/16 04:40 PM

    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 ?


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 2.  RE: Problem with dateTime, unmarshalling error

    Posted 04/12/16 12:06 AM

    Can you try with nillable=“true” attribute

    <xsd:element name=“dateEffect” type=“xsd:dateTime” nillable=“true”/>


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 3.  RE: Problem with dateTime, unmarshalling error

    Posted 04/12/16 04:59 AM

    Oups… it’s of course the first thing i’ve tried yesterday… but…
    hum… i’m stupid :? … I’ve forgot to regenerate my JavaCXF client before re-testing…

    Thanks for you reply : you make me remind i have to recreate the class with the new attribute :stuck_out_tongue:

    Regards


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 4.  RE: Problem with dateTime, unmarshalling error

    Posted 04/15/16 10:41 AM

    Hi,

    Now “nillable = true” my first issue is corrected.

    Unfortunately I met another problem : my service sometimes returns this king of date : dateEffect = 2015-11-02 00:00:00.0

    So, when I call the web service with Java-CXF, this exception is raised… how can I deal with this please ?
    (the value comes from ORACLE DATE field, that does not contains day-month-year information)

    why this date “2015-11-02 00:00:00.0” date is not accepted from JavaX=CXF please ?

    
    Caused by: javax.xml.bind.UnmarshalException: 2015-12-01 00:00:00.0
    - with linked exception:
    [java.lang.IllegalArgumentException: 2015-12-01 00:00:00.0]
    ... 39 more
    Caused by: java.lang.IllegalArgumentException: 2015-12-01 00:00:00.0
    at com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl$Parser.parse(XMLGregorianCalendarImpl.java:2823)
    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

    Regards

    EDIT :
    I’ve found the explanation : my ORACLE Adapter was specyfying the RETURN type as VARCHAR and not as DATE.
    So now it’s ok :smiley:


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 5.  RE: Problem with dateTime, unmarshalling error

    Posted 04/17/16 11:45 PM

    Just to add the xml datetime format is YYYY-MM-DDThh:mm:ss

    Good to know you already solved the issue


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 6.  RE: Problem with dateTime, unmarshalling error

    Posted 04/25/16 05:54 AM