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
  • 1.  Service to convert String to Date

    Posted Tue August 26, 2003 06:06 PM

    Hi,
    I am integrating AS400 to Oracle. I am using WmDB package from AS400 to webMethods and JDBC adapter from webMethods to Oracle. My problem is, 3 fields which I extract from AS400 are String fields which contain date,for example hire_date etc., Now I have to insert this field into a date field on Oracle. Is there any service like String to Date in webMethods. I am using Integration Server/Developer 6.0.1 and Windows NT. Pls…help me…!!!
    Thanks,
    Lavanya


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


  • 2.  RE: Service to convert String to Date

    Posted Wed August 27, 2003 08:21 PM

    You may wish to look at pub.date folder in WmPublic Package. There are a few Java Services that may solve your problem.

    All the best


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


  • 3.  RE: Service to convert String to Date

    Posted Wed August 27, 2003 08:45 PM

    You can create a java service to achieve this. The code is :

    IDataCursor cursor = pipeline.getCursor();

    String dateFormat = “MM/dd/yyyy”;
    String dateString = null;

    if(cursor.first(“dateString”))
    {
    dateString = (String)cursor.getValue();
    }
    else
    {
    throw new ServiceException(“Missing input ‘date’”);
    }

    if (cursor.first(“pattern”))
    {
    dateFormat = (String)cursor.getValue();
    }

    SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
    Date date;
    try
    {
    date = sdf.parse(dateString);
    IDataUtil.put(cursor, “date”, date);
    }
    catch (ParseException pe)
    {
    throw new ServiceException(“Date '” + dateString +
    “’ cannot be parsed using the format '” + dateFormat + “'”);
    }
    finally
    {
    cursor.destroy();
    }


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


  • 4.  RE: Service to convert String to Date

    Posted Wed August 27, 2003 09:53 PM

    Adapter Service should do this for you. Initially we had the similar problem with JDBC Adpater. We got a fix from wM. So check the advantage site for this fix. While creating the Adpater service put input type as String and JDBC type as Date. We are passing the date in yyyy-MM-dd format and its updates the table w/o any error. There is no need to create the String to date before calling the Adapter Service.

    Hope it helps.
    Pankaj


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


  • 5.  RE: Service to convert String to Date

    Posted Thu August 28, 2003 09:30 PM

    Hey Rupinder and Pankaj,

    Thanks abt that. It really worked both ways :slight_smile:
    Thanks a lot…!!!

    Lavanya


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


  • 6.  RE: Service to convert String to Date

    Posted Thu August 28, 2003 09:32 PM

    Hi Sudheer,
    Actually I was looking for String to Date. In the pub.date folder we have Date to String but not String to Date. Rupinder and Pankaj’s replies really worked well.

    Thanks,
    Lavanya


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