WebServiceException - cWebService
Used to generate a web service exception (soap fault)
Type: Procedure
Parameters
| Parameter | Type | Description |
|---|---|---|
| sError | String | Error Description |
Syntax
Procedure WebServiceException String sError
Call Example
Send WebServiceException sError
Description
WebServiceException provides a method for rasing an exception in a web service function. The message takes one parameter, a string description of the exception. The message causes the soap response to return a soap fault. The faultcode will be "soap:Server" and the faultdescription will contain the the value passed in sError.
After sending the messages you should always end your operation by exiting the function.
The following web-service operation (function) returns a greeting string based on a passed name. If the name is empty, an exception will be raised.
Function SayHello String sName Returns String
String sReturn
// if sName is empty, raise an exception
If (trim(sName)="") begin
Send WebServiceException "Blank names are not allowed"
function_return // always return after exception.
end
Move ("Hello, "+sName) to sReturn
Function_Return sReturn
End_Function