Designer 10.7 | webMethods Service Development Help | Failure Handling in Flow Services Using the TRY, CATCH, and FINALLY Steps | Usage Patterns for Failure Handling | TRY-FINALLY
 
TRY-FINALLY
The TRY-FINALLY usage pattern consists of a single TRY step followed by a FINALLY step. The TRY step contains any number of child steps to be executed. The FINALLY step contains any number of child steps to execute regardless of the outcome of the TRY step. The TRY-FINALLY usage pattern does not handle any failures that occur in the TRY step. As a result, any failure from the TRY step remains pending. After the FINALLY step completes, Integration Server propagates the failure to the parent flow step of the TRY step if the FINALLY step completes normally.
Integration Server executes a TRY-FINALLY in the following way:
1. Integration Server executes the steps contained in the TRY step sequentially until all steps have been executed or one of the steps fails. When a failure occurs in one of the child steps, Integration Server does not execute the remainder of the child steps. Instead Integration Server exits the TRY step.
2. Integration Server executes the FINALLY step.
3. If the FINALLY step completes normally, Integration Server propagates any failure from the TRY step to the parent flow step. If, however, a failure occurs during execution of the FINALLY step, that failure is propagated up to the parent flow step. That is, the failure from the FINALLY step replaces the FAILURE from the TRY step. If the FINALLY step completes abruptly, Integration Server discards the uncaught failure. Abrupt completion is caused by execution of a child EXIT step configured to signal success.
In the following example flow service, a TRY step executes the pub.file:getFile service followed by the pub.xml:getXMLNodeIterator service. If either service throws a service exception, Integration Server exits the TRY step. Then Integration Server executes the FINALLY step which includes the pub.io:close service to close an open InputStream.
Example of a TRY-FINALLY