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 : Managing a SOAP fault
 

Managing a SOAP fault

On detecting a SOAP fault, OpenEdge automatically creates a SOAP-fault object for it. This object contains information from each child element of the response message <Fault> element. Like the ERROR-STATUS handle information, OpenEdge makes this object available only until the next statement executes with the NO-ERROR option.
Note: As indicated in the following table, certain members are associated with a specific SOAP version. To determine which SOAP version is in use, use the SOAP-VERSION attribute of the server object handle.
The following table lists the attributes on the SOAP-fault object, which contains no methods.
Table 39. SOAP-fault object attributes
Attribute
Type
Description
SOAP-FAULT-ACTOR
CHARACTER
(SOAP Version  1.1 only) Returns the value of the <faultactor> element of the SOAP fault message, which is a URI that identifies the Web service returning the fault. Replaced in SOAP Version  1.2 by the combination of SOAP-FAULT-ROLE and SOAP-FAULT-NODE.
SOAP-FAULT-CODE
CHARACTER
Returns the value of the <faultcode> element of the SOAP fault message, which identifies the fault.
SOAP-FAULT-DETAIL
HANDLE
References the SOAP fault-detail object, which contains more application-specific error information.
SOAP-FAULT- MISUNDERSTOOD- HEADER
CHARACTER
(SOAP 1.2 only) Returns the list of fully qualified names of SOAP headers, if any, for which mandatory processing (as designated by the SOAP-ENV:mustUnderstand attribute) failed.
SOAP-FAULT-NODE
CHARACTER
(SOAP 1.2 only) Returns the URI of the SOAP node that generated the SOAP-fault object, if available. In combination with SOAP-FAULT-ROLE, replaces the SOAP-FAULT-ACTOR attribute used in SOAP Version 1.1.
SOAP-FAULT-ROLE
CHARACTER
(SOAP 1.2 only) Returns the URI that identifies the role in which the node that generated the SOAP-fault object was operating when the fault occurred. In combination with SOAP-FAULT-NODE, replaces the SOAP-FAULT-ACTOR attribute used in SOAP Version 1.1.
SOAP-FAULT-STRING
CHARACTER
Returns the value of the <faultstring> element of the SOAP fault message, which provides a human-readable description of the fault.
SOAP-FAULT-SUBCODE
CHARACTER
(SOAP 1.2 only) Returns the list of fully qualified sub-code names for the SOAP-fault object.
TYPE
CHARACTER
Returns the handle type, "SOAP-FAULT".
As you can see, these attributes provide access to all the elements of a SOAP fault you might encounter.
Because the <detail> element has essentially no standard definition, and can contain any elements that the Web service chooses to generate, OpenEdge provides another object, the SOAP fault-detail object, to return this information to the ABL application. If the SOAP fault message contains a <detail> element, the SOAP-FAULT-DETAIL attribute on the SOAP-fault object handle returns a handle to the SOAP fault-detail object that is generated for it. Otherwise, this attribute returns the Unknown value (?). As is the case with the SOAP-fault object, OpenEdge makes the SOAP fault-detail object available only until the next ABL statement that executes with the NO-ERROR option.
The following table describes the single attribute of the SOAP fault-detail object:
Table 40. SOAP fault-detail object attributes
Attribute
Type
Description
TYPE
CHARACTER
Returns the handle type, "SOAP-FAULT-DETAIL"
The following table lists the methods of the SOAP fault-detail object.
Table 41. SOAP fault-detail object methods
Method
Type
Description
GET-NODE( )
LOGICAL
Returns a handle to an X-noderef object that references the root node (SOAP <detail> element) of a DOM tree containing the parsed XML for the underlying SOAP detail information
GET-SERIALIZED( )
LONGCHAR
Returns the XML for the underlying SOAP fault detail information in serialized form
The GET-NODE( ) and GET-SERIALIZED( ) methods provide access to the elements of the SOAP fault detail information in exactly the same way as they provide access to SOAP header entries for a SOAP header. For more information, see Handling SOAP Message Headers in ABL.
The general approach to managing SOAP fault detail elements is identical to retrieving and scanning the header entries of a SOAP response header. The structure of elements that make up the SOAP fault detail information is completely undefined. For more information, see the documentation available for the Web service you are accessing.
As with SOAP headers, if the WSDL Analyzer can identify a temp-table or ProDataSet definition that maps to the SOAP fault detail, you can use the GET-SERIALIZED( ) method in conjunction with the READ-XML( ) method of the documented ABL object (temp-table or ProDataSet) to access the SOAP fault detail data. However, this is unlikely, and you most often must access the data using a DOM tree or the ABL SAX reader. For more information on how the Analyzer might identify a temp-table or ProDataSet to access the SOAP fault detail, see Analyzing complex data. For more information on the ABL DOM, SAX, and temp-table/ProDataSet XML features, see OpenEdge Development: Working with XML.