webMethods

webMethods

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

EXIT from $parent and signal FAILURE doesn't throw Exception?

  • 1.  EXIT from $parent and signal FAILURE doesn't throw Exception?

    Posted Fri December 02, 2011 09:48 AM

    Hi,

    I hava a Flow Service like this:

    SEQUENCE (TRY & CATCH)
    SEQUENCE (TRY)
    ... (do something here)
    BRANCH
    $null: SEQUENCE
    ... (do something here)
    [B]EXIT from $parent and signal FAILURE (I also filled the Failure Message)[/b]
    
    ... (do something here)
    
    SEQUENCE (CATCH)
    [B]Invoke: pub.flow:getLastError[/b]
    Invoke: pub.flow:debugLog (The message contains: %lastError/error%)

    The problem is: in SEQUENCE (CATCH), the pub.flow:getLastError doesn’t return lastError output, which means the lastError output is null. Suppose it works, the lastError/error should contains the filled Failure Message.

    It seems when called EXIT from $parent and signal FAILURE, it doesn’t throw any Exception information for getLastError. Is that true?

    On contrary, for the case of EXIT from $flow and signal FAILURE, it will generate exception that can be catched in Catch Sequence (of course, you must have a parent flow service that has try-catch sequence). Then if you call getLastError there, you will get exception information. But for EXIT from $parent and signal FAILURE, the getLastError doesn’t return any exception information. I don’t know why.


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


  • 2.  RE: EXIT from $parent and signal FAILURE doesn't throw Exception?

    Posted Fri December 02, 2011 09:32 PM

    Hello,

    If you are calling flow service B from A i.e. A is parent to B then you don’t need to have a try catch for B. Did you tried this? and still ‘Exit from $parent and signal failure’ not working?

    Thank you,
    Anil


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


  • 3.  RE: EXIT from $parent and signal FAILURE doesn't throw Exception?

    Posted Fri December 02, 2011 09:35 PM

    And looks like from the code .You do have try catch in your child (service B) . Correct me if my understanding is wrong


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


  • 4.  RE: EXIT from $parent and signal FAILURE doesn't throw Exception?

    Posted Sat December 03, 2011 07:29 AM

    It doesn’t matter if service B has try-catch or not, the sure thing is if service B calls “Exit from $flow & signal Failure”, it will throw exception (but usually I will put the “Exit from $flow & signal Failure” in catch sequence). Of course, service A (who calls the service B) should has try-catch to catch the exception.

    Btw, that is not my primary topic/question for this thread anyway.

    It’s only a single flow service. No service A, no service B.

    The topic/question of this thread is about why “EXIT from $parent and signal FAILURE” doesn’t throw Exception Information for getLastError?


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


  • 5.  RE: EXIT from $parent and signal FAILURE doesn't throw Exception?

    Posted Sun December 04, 2011 10:54 PM

    For some reason i misread your post.

    Normally i custom label the step i want to exit from and signal failure . And it always worked for me.


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


  • 6.  RE: EXIT from $parent and signal FAILURE doesn't throw Exception?

    Posted Mon December 05, 2011 04:25 PM

    I found a solution.

    Use pub.flow:throwExceptionForRetry in place of EXIT from $parent and signal FAILURE.

    Thx to arnaudW.


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


  • 7.  RE: EXIT from $parent and signal FAILURE doesn't throw Exception?

    Posted Mon December 05, 2011 05:25 PM

    Since you’re catching the exception thrown by throwExceptionForRetry, there probably is no retry performed. This may lead to confusion for those that edit/maintain this service later.

    I had encountered the beahvior of EXIT and signal FAILURE not populating lastError some years back. Because of that I never use EXIT and signal FAILURE. I wrote a simple Java service that accepts a string and throws a ServiceException and I always use that. This is more or less what throwExceptionForRetry does but without the potential confusion of “if I call this will it retry?”


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


  • 8.  RE: EXIT from $parent and signal FAILURE doesn't throw Exception?

    Posted Tue December 06, 2011 03:28 AM

    Thanks for your explanation. I think I’m gonna use your way :slight_smile:


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


  • 9.  RE: EXIT from $parent and signal FAILURE doesn't throw Exception?

    Posted Thu July 24, 2014 05:35 AM

    Well,afer some tests,there must be some problem in the CODE you write.
    In the Built-In service refernece,pay attention to the usage notes of “pub.flow:getLastError”,it reads:

    “Each execution of a service (whether the service succeeds or fails) updates the value
    returned by getLastError. Consequently, getLastError itself resets the value of lastError.
    Therefore, if the results of getLastError will be used as input to subsequent services, map
    the value of lastError to a variable in the pipeline.”

    This means that , in the catch sequence,u can not put any service befre the “pub.flow:getLastError”,including transform used in the MAP!

    so ,you’d make sure ,in the catch sequence, there are no services/no transforms in MAP before pub.flow:getLastError,

    I suggest to make “pub.flow:getLastError” the first step in the catch sequence.

    Hope this will help.
    Regards!
    Yee.


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


  • 10.  RE: EXIT from $parent and signal FAILURE doesn't throw Exception?

    Posted Thu July 24, 2014 01:32 PM

    "I suggest to make “pub.flow:getLastError” the first step in the catch sequence. "

    Yes this is the standard way to go in any Catch sequence…

    HTH,
    RMG


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


  • 11.  RE: EXIT from $parent and signal FAILURE doesn't throw Exception?

    Posted Sat November 15, 2014 12:13 PM

    Hi as i see from the first post of yours i saw you are writing all this code under a branch statement with the label as null are you sure the code flows into it ?
    if yes the Exit should be properly working , just made a similar and checked with a label chaneg and it worked


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


  • 12.  RE: EXIT from $parent and signal FAILURE doesn't throw Exception?

    Posted Wed January 21, 2015 10:23 AM

    In the EXIT step there is a field “Failure message”. You need to fill this with an appropriate error message. So when control passes to the getLastError service your error message will be placed in lastError/error variable. The reason why “Failure message” has to be populated is because webMethods does not know what type of error you have identified so you give some meaningful error string. You can even add in values from other variables using the syntax %myvariable%.

    The difference with “EXIT from $flow and signal FAILURE” is telling webMethods to fail the whole service. webMethods then populates lastError/error variable with a flow related error message.


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


  • 13.  RE: EXIT from $parent and signal FAILURE doesn't throw Exception?

    Posted Tue January 27, 2015 03:19 PM

    Hi Bromo .

    The answer of your question is mentioned in the usage of notes of getLastError service , refer BIS guide .
    It says :-

    If you are using exit $parent signal failure in a flow service , then in the same flow service , the lastError document will not be updated.


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