This sample illustrates the basics of fault handling.
Introducing the <throw> Construct
In fault handling, <throw/> and <rethrow/> are used to generate faults where faults occurs.
Faults should be named with a unique scope level qualified name. For example,
Used only inside <catch/> or <catchAll/>, which will be described later in order to re-throw the originally caught exceptions. For example,
Fault handling is implemented inside <faultHandlers/>. Faults can be handled based on qualified name of the thrown fault using <catch/> or every non-specified faults can be handles inside <catchAll/>. For example,
<faultHandlers/> should be defined in a parent scope.
Deploying the Sample
WSO2 BPS provides a sample, which can be deployed and executed to understand fault handling. Follow the instructions below to deploy and trigger the process.
1. Log in into BPS server management console and select "Processes -> Add" under the "Main" menu.
2. Upload the
3. In the "Deployed Processes" window, click the "Process ID" to access its "Process Information" window.
4. Under the "WSDL Details" widget, trigger the process using the "TryIt" link to create an instance of it.
Refer ThrowCatchFaultHandling.zip. In the child scope the input value is checked to see if it is equal to
1. If so, an
InputException1 is thrown. Note that the thrown exception has a
"saw:InputException1" qualified name. For example,
In the parent scope, the exception is filtered against its qualified name. For example,