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.

 View Only
Expand all | Collapse all

Problem with pub.date:dateTimeFormat

  • 1.  Problem with pub.date:dateTimeFormat

    Posted Thu December 06, 2007 04:01 PM

    Hello,

    We have tried to use the service pub.date:dateTimeFormat to validate an input date.

    When the date is null or is a formal string (ex : 'is_not_a_date) or doesn’t respect the current pattern, the service generates an exception.

    But, if the string respects the current pattern but is not a “calendar” date (ex : 2007-14-06 16:27:32), these date is accepted by the service and transformed in a “valid” date : 2008-02-06 16:27:32 - if the newpattern is the same).

    We are amazed by that fact :confused: .

    (I’m not a java expert :blush: )

    Thanx in advance for your response.

    Christophe


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


  • 2.  RE: Problem with pub.date:dateTimeFormat

    Posted Thu December 06, 2007 04:30 PM

    This is a known behavior of the Java classes that manipulate date strings.

    A common way to detect this sort of issue in Java is to convert the first string to a Date object. Then convert that to a result string with the same format as the first string.

    Compare the first and result string. If they are not the same, the first string had “bad” components.

    The way to do this with pub.date:dateTimeFormat is to simply compare the input and output date strings. If they are not the same, then the input date is invalid. The downside is that you can’t tell which part of the string is bad, but that can be a chore for the caller. :slight_smile:


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


  • 3.  RE: Problem with pub.date:dateTimeFormat

    Posted Fri December 07, 2007 08:54 AM

    Thank you Reamon for your answer.

    I have had already implemented this workaround. It works perfectly (for my need ;-).
    We will have a “java” approach for the next uses of Built-in services in the future.

    Christophe


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