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.  Try catch block with continue

    Posted Fri August 08, 2008 07:36 AM

    Hi,

    I am little new to WM and trying to develop few services. I have a for loop in which i am calling JDBC adapter service which inserts the record in DB but if there is anything wrong in insert statement then the whole service boms out instead i want to use try catch block along with continue statement. I mean if there is any exception it should keep inserting remaing records.

    Please help me to understand how best i can do this.

    Thanks
    Atul


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


  • 2.  RE: Try catch block with continue

    Posted Fri August 08, 2008 01:40 PM

    Hi Atul,

    This will work the way you want :

    1.main sequence
    1.1 try sequence
    1.1.1 loop
    1.1.1.1 main sequence
    1.1.1.1.1 try sequence
    1.1.1.1.1.1 jdbc service
    1.1.1.1.1 catch sequence
    1.1 catch sequence

    Basically what you have to do is have try-catch block (child) inside a try-catch block (parent) and the loop should on try-catch block (child).

    Hope you get what I want to say.

    Regards,
    Sumit


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


  • 3.  RE: Try catch block with continue

    Posted Fri August 08, 2008 05:58 PM

    Hi Sumit,

    Thanks for the reply. I will try our your solution today. One thing which i want to ask here is will it insert remaining records in DB if there is any exception in JDBC service for say any record?

    The reason i am asking you this is i don’t see any continue statement in this praposed solution.

    Thanks
    Atul


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


  • 4.  RE: Try catch block with continue

    Posted Fri August 08, 2008 06:56 PM

    Hi Atul,

    There is no continue statement in flow.
    What you want to do is in case of any exception in loop, catch it in (child) catch block but do not roll back or throw exception, in this case it will continue to next record.

    In case of any exception outside your loop, it will be caught in final (parent) catch block, there you can roll back transaction and commit in the last step of your (parent) try block.

    Regards,
    Sumit


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


  • 5.  RE: Try catch block with continue

    Posted Fri August 08, 2008 07:41 PM

    Hi Sumit,

    I tried your suggestion. Have alook of attached file. But still if any records fails the whole service boms out.

    Please suggest.
    Trycatch-block.GIF


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


  • 6.  RE: Try catch block with continue

    Posted Fri August 08, 2008 08:06 PM

    Hi Atul,

    2 things :

    1. You have not implemented parent try-catch block (its anyway optional)
    2. In child try-catch block, all the flow steps should be inside "Try Block Exit On Failure"i.e. MAP, GetNextUniqueKeyID etc… should be inside try block.

    Also did u set “Main for Loop Sequence” block as “Exit on Success” ?

    Regards,
    Sumit


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


  • 7.  RE: Try catch block with continue

    Posted Fri August 08, 2008 10:17 PM

    Hey Sumit, u r gr8 man. It is working now the way i wanted.

    Thanks, Appreciated.

    Atul


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