Failure Messages
The failure message is returned in both of the following cases:
When a failure is returned by the native API provider.
In this case, the $ERROR_MESSAGE variable in the failure message will contain the message produced by the provider's exception that caused the error. This is equivalent to the getMessage call on the Java Exception.
When a failure is returned by internal
Mediator exceptions (such as policy violation errors, timeouts, and so on).
In this case, $ERROR_MESSAGE will contain the error message generated by Mediator.
Alternatively, you can configure global failure messages for all APIs, using Mediator's Service Fault Configuration page, as described in Administering webMethods Mediator.
Mediator returns the following failure message to the consuming application:
Mediator encountered an error:$ERROR_MESSAGE while executing
operation:$OPERATION service:$SERVICE at time:$TIME on date:$DATE.
The client ip was:$CLIENT_IP. The current user:$USER.
The consumer application:$CONSUMER_APPLICATION".
The precedence of the Failure Message configurations is as follows:
If you configure a Conditional Error Processing action for an API, the failure message configurations take precedence over any settings on the global Service Fault Configuration page.
If you do not configure a Conditional Error Processing action for an API, the settings on the Service Fault Configuration page take precedence.
The default failure message contains predefined fault handler variables ($ERROR_MESSAGE, $OPERATION, and so on.) which are described in the table below.
You can customize the default failure message using the following substitution variables, where Mediator replaces the variable reference with the real content at run time:
Note: | If you want to reference a custom context variable that you have already defined in a virtual API (as opposed to one you have The API for Context Variables), you must add the prefix $mx to the variable name in order to reference the variable. For example, if you defined the variable TAXID, you would reference it as $mx:TAXID. |
The fault handler variables are described below.
Note: | If no value is defined for a fault handler variable, then the returned value will be the literal string “null”. For example, $CONSUMER_APPLICATION will always be "null" if the service's policy does not contain at least one of the “Evaluate” actions. |
Fault Handler Variable | Description |
$ERROR_MESSAGE | The error message produced by the exception that is causing the error. This is equivalent to the getMessage call on the Java Exception. This maps to the faultString element for SOAP 1.1 or the Reason element for SOAP 1.2 catch. |
$OPERATION | The operation that was invoked when this error occurred. |
$SERVICE | The service that was invoked when this error occurred. |
$TIME | The time (as determined on the Container side) at which the error occurred. |
$DATE | The date (as determined on the Container side) at which the error occurred. |
$CLIENT_IP | The IP address of the client invoking the service. This might be available for only certain invoking protocols, such as HTTP(S). |
$USER | The currently authenticated user. The user will be present only if the Transport/SOAP Message have user credentials. |
$CONSUMER_APPLICATION | The currently identified consumer application (client). |
$NATIVE_STATUS_CODE | The HTTP error status code that is returned by the native service. |