| SOAP features / SOAP Fault | |
If a SOAP fault occured the operation returns the SOAP fault number in the operation status. The SOAP fault number is defined in the generated stubs as a 4GL constant prefixed with the string FaultID_.
# List of Soap fault constants CONSTANT FaultID_DividedByZero = 1 ... # VARIABLE : DividedByZero DEFINE DividedByZero STRING ATTRIBUTE(XMLName="DividedByZero", XMLNamespace="http://tempuri.org/") ... # Operation: Divide # FAULT #1: GLOBALS DividedByZero
You can test the operation status code accordingly and display the SOAP fault message.
ON ACTION divide
CALL Divide(op1, op2) RETURNING wsstatus, result, remaind
CASE wsstatus
WHEN 0
DISPLAY BY NAME result,remaind
DISPLAY "OK" TO msg
WHEN FaultID_DividedByZero
DISPLAY DividedByZero TO msg
OTHERWISE
DISPLAY wsError.description TO msg
END CASE