About this task
The following example shows how to deal with errors while consuming the Web service.
Procedure
- Delete the connection between the Step1 and Step2 tasks, drop the XOR Gateway from the Palette onto the workspace between Step1 and Step2, then connect Step1 to the Gateway and connect the Gateway to Step2.
-
Select the Gateway output line, and on the
General view, enter the condition
cRM_Status != null in the
Condition field.
- On the General view of the Step1 icon, select the Connectors tab then select the CRMService_getCRMInformation connector and click Edit.
-
Select the Ignore error and continue process reaction in
the field named If connector fails..., click
Next and then click Finish.
This allows the process to continue regardless of the response returned by the Web service.Now, as the process will continue even in case of exception, you are able to process errors.
- Drop a new human task, Step3, from the Palette onto the process design workspace, and assign the Initiator actor to it as we did for Step2.
- Add a branch to the Gateway and connect it to Step3, and then connect Step3 to the end event of the process.
-
Select the alternative Gateway branch. On the
General view, enter the condition
cRM_Status == null in the
Condition field.
-
Create a new form for Step3, with the check box for the
cRM_Status variable cleared. This form will display
the error message.
-
Add the Message element on the form. Select the
Data tab of the General view
and enter the text: Error occurred while calling the CRM
Service! in the Initial value field in
the Form perspective.
- Next, emulate the exceptional situation: shut down the OSGI container of Talend ESB so that the Web services are no longer available, and run your process.
Results
After trying to consume the unavailable service, you get the following screen.