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 in try/catch sequence..!

webMethods Community Member

webMethods Community MemberTue July 12, 2011 12:49 PM

  • 1.  problem in try/catch sequence..!

    Posted Tue July 12, 2011 05:40 AM

    i have a problem in try/catch sequence…

    i am assigning a value 2 to res variable in try seq…

    i want that res value in catch seq…

    main sequence(exit on success)
    {
    try seq(exit on failure)
    {
    if a!=2 // i will give input other than 2
    {
    set res to 2 in a MAP
    }
    }
    catch seq(exit on done)
    {
    // i want to get res value here…ie in results i want to see res=2
    }
    }

    this flow doesn’t produce res=2 in result…bcoz…in try seq…exit on failure IS will roll back pipeline values before seq…!.

    any alternative…any java service…! plz…help me…:sad::confused:


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


  • 2.  RE: problem in try/catch sequence..!

    Posted Tue July 12, 2011 12:49 PM


  • 3.  RE: problem in try/catch sequence..!

    Posted Tue July 12, 2011 02:01 PM

    you can use pub.flow.getLastError to retrieve the state of the pipeline at the time the exception occurred.


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


  • 4.  RE: problem in try/catch sequence..!

    Posted Tue July 12, 2011 02:40 PM

    we have to use that flow step in catch block…?i used that…but still no visible of res…i think once we get out of try block with exit on failure…all variables in try block can’t be accessed in catch block…any alternative…?any java services…?

    plz…try above code in developer…and help me…

    thanks…!:sad:


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


  • 5.  RE: problem in try/catch sequence..!

    Posted Tue July 12, 2011 02:55 PM

    OK,

    I think your problem is the “Exit and signal failure”.

    Try “WmPublic/pub.flow:throwExceptionForRetry” instead, in order to throw a “real” error.

    Then you will see the pipeline in the lastError document after the call of getLastError.


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


  • 6.  RE: problem in try/catch sequence..!

    Posted Tue July 12, 2011 03:39 PM

    Did you check in LastError/Pipeline…?


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


  • 7.  RE: problem in try/catch sequence..!

    Posted Tue July 12, 2011 03:41 PM

    The information Arnaud provided is the thing to do (exit and signal error isn’t the problem though). Call getLastError. It returns a document. One of the fields is “pipeline”, which is a document holding all pipeline vars as they were at the time of the error.

    It won’t show you the pipeline contents within Developer. You’ll need to explicitly add and map variables that you want out of the pipeline document. That means, modify the “pipeline” document to add your “res” variable to it, then map it out to another var.


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


  • 8.  RE: problem in try/catch sequence..!

    Posted Tue July 12, 2011 03:42 PM

    if you use “Exit with signal failure”, the getlastError return no document.


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


  • 9.  RE: problem in try/catch sequence..!

    Posted Tue July 12, 2011 03:44 PM

    thank you very much…!

    i got it…!

    thanks for your support…


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


  • 10.  RE: problem in try/catch sequence..!

    Posted Tue July 12, 2011 04:12 PM

    That’s not what the code is doing. The SEQUENCE is exit on failure. The code isn’t doing EXIT signal failure. At least that’s how I’m reading the pseudocode.


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


  • 11.  RE: problem in try/catch sequence..!

    Posted Thu January 18, 2018 02:23 PM

    Hi,

    getLastError needs to be the first step in the catch sequence, otherwise the error state and information is lost.

    Regards,
    Holger


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