Web Services Quick Start Tutorial
Generating a SOAP Fault
Every place in Web Service producer code that could generate an error should be able to generate SOAP faults. To avoid repeating the SOAP fault generating code multiple times, you can create a single method that generates the fault. This method can be invoked from every location in your producer code that can generate an error.
The following method takes the error code and detail as parameters and generates an appropriate SOAP fault. It invokes the %SOAP.WebService ReturnFault
method which stops execution of the Web Service immediately and returns a valid SOAP message to the client. This SOAP envelope contains the SOAP fault instead of the regular data body.
Method ApplicationError(code, detail)
set fault.faultstring="application error"
// ReturnFault must be called to send the fault to the client.
// ReturnFault will not return here.