Software AG Products 10.7 | Integrating On-Premises and Cloud Applications | Service Development | Working with Web Services | About SOAP Fault Processing | About SOAP Fault Elements | Adding a Fault Element to an Operation
 
Adding a Fault Element to an Operation
Keep the following points in mind when adding fault elements to an operation:
*You add fault elements to an operation response.
*The fault document must be an IS document type.
*You must set up a package dependency if you use an IS document type from a different package as a fault.
*If you add a fault to an operation that uses an In-Only Message Exchange Pattern (MEP), the MEP will change to Robust In-Only MEP. For more information about message exchange patterns, see the Web Services Developer’s Guide.
*To add a fault element to an operation
1. In Package Navigator view, open and lock the web service descriptor to which you want to add a fault element.
2. In the Operations tab, expand the operation and the response to which you want to add the fault element.
3. Select the Fault icon and click (Add Header or Fault button) on the web service descriptor editor toolbar.
Because a fault was selected when you clicked this button, Designer displays the default document selector dialog.
4. Select the IS document type to use as the fault element. Click OK.
5. If you want to change the name of the fault element, with the fault element selected, in the General category of the Properties view, update the Name property.
6. Click File > Save.
Important:
When you add a fault to a consumer web service descriptor, you must refresh the web service connector(s). See Refreshing a Web Service Connector.
Notes:
*If you add a fault element to an operation in a consumer web service descriptor, and then refresh the web service connector, Integration Server updates the logic of the web service connector to look for and handle the fault at run time.
*If you add a fault element to an operation in a WSDL first provider web service descriptor, the WSDL document generated from the provider web service descriptor will include the new faults as soap:fault elements in the operation.
*You can add multiple fault elements to an operation in a web service descriptor. At run time, if the service that corresponds to the operation returns multiple fault documents, the SOAP fault in the resulting SOAP response will contain only one fault document. Specifically, Integration Server returns the fault document that is an instance of the IS document type that appears first in the operations list of fault elements.
For example, suppose that an operation had three fault elements listed in this order: faultA, faultB, and faultC. Note that each fault element corresponds to an IS document type of the same name. At run time, execution of operation (service) results in two fault documents—one for faultB and one for faultC. In the SOAP response generated by Integration Server, the SOAP fault contains the faultB document only.