Try OpenEdge Now
skip to main content
Web Services
Creating ABL Clients to Consume OpenEdge SOAP Web Services : Handling Errors in ABL Requests to OpenEdge SOAP Web Services : Detecting a SOAP fault : SOAP faults with structured error handling
 
SOAP faults with structured error handling
You can also trap the error using a CATCH block, which is the error handler for the ABL structured error handling model. In this scenario, the AVM generates an error object based on the built-in Progress.Lang.SoapFaultError class. The SoapFault property of the class contains a handle to the built-in SOAP-fault object. Recall that the SOAP-fault object is the ABL representation of a SOAP fault. Thus, SoapFaultError error object is a wrapper for the same SOAP-fault object you could also have accessed using the NO-ERROR option and the ERROR-OBJECT-DETAIL attribute of the ERROR-STATUS system handle.
This is the basic structure of a block with a CATCH block:
DO ON ERROR UNDO, THROW:
  /* Web service call, do not use the NO-ERROR option. */
  CATCH mySoapErrorObject AS Progress.Lang.SoapFaultError:
    /* Access and interrogate the SOAP-fault object wrapped by the error
       object. */
  END CATCH.
END /* DO */
Examples of ABL accessing a SOAP fault provides more detailed information.
Structured error handling represents errors as objects. ABL includes a hierarchy of classes that allow all error types to be represented as objects. The following table summarizes the class representing all system errors and its subclass that represents SOAP errors.
Table 37. System error classes
Class
Members
Description
Progress.Lang.SysError
Inherits the Progress.Lang.ProError members:
*CallStack property
*NumMessages property
*Severity property
*GetMessage( ) method
*GetMessageNum( ) method
A subclass of Progress.Lang.ProError that represents (with its subclasses) all ABL system errors
Progress.Lang.SoapFaultError
Inherits the Progress.Lang.ProError members and adds:
*SoapFault
A subclass of Progress.Lang.SysError that contains a reference to a Web service SoapFault object
The following table describes the properties and methods of the Progress.Lang.SoapFaultError class.
Table 38. SoapFaultError class members
Member
Description
CallStack property
Returns the contents of the call stack at the time the error object was thrown as a string. If the ERROR-STACK-TRACE attribute of the SESSION handle is false, then this property returns the Unknown value (?). To enable the call stack, set SESSION:ERROR-STACK-TRACE property to TRUE directly, or use the -errorstack session startup parameter.
NumMessages property
In ABL, an error is represented as a pair of values. The message number is a unique number identifying the particular error. The error message is a string which describes the error. This property indicates how many error number and error message the error object contains.
Severity property
The Severity property is not used by ABL system errors. It is provided as a mechanism for you to use to assign severity rankings to your various application errors (Progress.Lang.AppError).
GetMessage( MessageIndex ) method
Returns the error message for the indexed error in the error object, beginning with one (1). If there is no error message at the indicated index, the method returns the empty string.
GetMessageNum( MessageIndex ) method
Returns the error message number associated with the indexed error in the error object. For Progress.Lang.SysError objects and subclasses, the method returns the Progress message number for the system generated error. If there is no error message at the index, the method returns the empty string.
SoapFault
Identifies the SOAP-FAULT object handle that contains a SOAP fault message detail.
If the ABL application invokes a Web service operation that returns a SOAP fault message, the AVM creates a SOAP-FAULT object. Use the SOAP-FAULT-DETAIL attribute of the SOAP-FAULT object handle to access the SOAP fault message detail.
see Managing a SOAP fault for more information about the SOAP-FAULT object.