API Gateway 10.7 | Using API Gateway | Policies | System-defined Stages and Policies | Error Handling | Conditional Error Processing
 
Conditional Error Processing
Error Handling is the process of passing an exception message issued as a result of a run-time error to take any necessary actions. This policy returns a custom error message (and the native provider's service fault content) to the application when the API Gateway or native provider returns a service fault. You can configure conditional error processing and use variables to create custom error messages.
The table lists the properties that you can specify for this policy:
Property
Description
Condition
Conditions are used to specify when the policy has to be executed. You can add multiple conditions with logical operators.
Available values are:
*AND. API Gateway transforms the error responses that comply with all the configured conditions
*OR. This is selected by default. API Gateway transforms the error responses that comply with any one configured condition.
Click Add Condition and provide the following information and click .
*Variable. Specifies the variable type with a syntax.
*Operator. Specifies the operator to use to relate variable and the value. You can select one of the following:
*Equals
*Equals ignore case
*Not equals
*Not equals ignore case
*Contains
*Not Contains
*Exists
*Not Exists
*Greater Than
*Less Than
*Value. Specifies a plain value or value with a syntax.
For details about the variables available in API Gateway, see Variables Available in API Gateway.
Pre-Processing. Specifies how the error response is to be processed before this policy processes it.
Invoke webMethods Integration Server Service
Specify the webMethods IS service to pre-process the error message.
Provide the following information
*webMethods IS Service. Specify the webMethods IS service to be invoked to pre-process the error messages.
You can add multiple entries for webMethods IS service by clicking .
*Run as User. Specifies the authentication mode to invoke the IS service. If this field is left blank the incoming credentials of the user, identified by API Gateway, are used to authenticate and invoke the IS service. You can also specify a particular user, you want API Gateway to use to run the IS service.
*Comply to IS Spec. Mark this as true if you want the input and the output parameters to comply to the IS Spec present in pub.apigateway.invokeISService.specifications folder in wmAPIGateway package.
*webMethods IS Service alias. Start typing the webMethods alias name and select the alias from the type-ahead search results displayed to add one or more aliases.
XSLT Transformation
Provide the XSLT file and feature you want to use to transform the service error response.
Click Browse to select the XSLT file and upload it.
Provide the following information for the XSLT feature:
*Feature Name. Specifies the name of the XSLT feature.
*Feature Value. Specifies the value for the feature.
You can add multiple entries for feature name and value by clicking .
Note:
API Gateway supports XSLT 1.0 and XSLT 2.0.
Transformation Configuration. Specifies various transformations to be configured.
Header Transformation
Customizes the list of headers in the error response that is sent to the client.
You can add or modify header parameters by providing the following information:
*Variable. Specifies the variable type with a syntax.
*Value. Specifies a plain value or value with a syntax.
You can add multiple variables and corresponding values by clicking .
You can remove any header by typing the plain value or value with a syntax.
For details about the variables available in API Gateway, see Variables Available in API Gateway.
Status Transformation
Specifies the status transformation to be configured for the error responses.
Provide the following information:
*Code. Specifies the status code that is sent in the response to the client.
For example if you want to transform status code as 403, provide 403 in the Code field.
*Message. Specifies the Status message that is sent in the response to the client.
For example The data you are looking for is not found can be used to transform the original 404 Not Found status message.
Define custom variables
Defines a custom variable name to a complex variable expression or constant value. This can be particularly useful when you want to use this complex expression multiple times in the error payload transformation or when you want to use a short notation for a complex variable expression.
Provide the following information:
*Variable. Specifies the variable type with a syntax.
*Value. Specifies a plain value or value with a syntax.
For example if you provide a variable as id and the corresponding value as ${response.payload.jsonPath[$.id]}, this creates a custom variable that can be used in failure message transformation.
For details about the variables available in API Gateway, see Variables Available in API Gateway.
Failure Message. Specifies the custom failure message format that API Gateway should send to the application.
Failure Messages
Specifies the payload transformation to be configured for the error responses.
*Click text and specify the payload to use to transform the error response messages as required.
*Click json and specify the payload to use to transform the error response messages as required.
*Click xml and specify the payload to use to transform the error response messages as required.
Note:
For a SOAP API, select the type text and provide the failure message to be included in the faultstring of the SOAP response.
Failure message in type json, xml are not used for the SOAP response
As this property supports variable framework, to transform the error response messages you can make use of the available variables in addition to the custom variables defined in this policy. For details about the variables available in API Gateway, see Variables Available in API Gateway.
*Click Send Native Provider Fault Message to send the native failure message to the application without applying payload transformation.
Post-Processing. Specifies how the error response sent by the native service is to be processed before sending the same to the application.
Invoke webMethods Integration Server Service
Specify the webMethods IS Service for post-processing the error message.
Provide the following information
*webMethods IS Service. Specify the webMethods IS service to be invoked to post-process the error messages.
You can add multiple entries for webMethods IS service by clicking .
*Run as User. Specifies the authentication mode to invoke the IS service. If this field is left blank the incoming credentials of the user, identified by API Gateway, are used to authenticate and invoke the IS service. You can also specify a particular user, you want API Gateway to use to run the IS service.
*Comply to IS Spec. Mark this as true if you want the input and the output parameters to comply to the IS Spec present in pub.apigateway.invokeISService.specifications folder in wmAPIGateway package.
*webMethods IS Service alias. Start typing the webMethods alias name and select the alias from the type-ahead search results displayed to add one or more aliases.
XSLT Transformation
Provide the XSLT file that you want to use to transform the service error response.
Provide the following information for the XSLT feature:
*Feature Name. Specifies the name of the XSLT feature.
*Feature Value. Specifies the value for the feature.
You can add multiple entries for feature names and values by clicking .
Note:
API Gateway supports XSLT 1.0 and XSLT 2.0.
Transformation Metadata. Specifies the metadata for transformation of the error responses received from the native API. For example, the namespaces configured in this section can be used when you provide the syntax for XPath ${response.payload.xpath} For example: ${response.payload.xpath[//ns:emp/ns:empName]}
Namespace
Specifies the namespace information to be configured for transformation. This is applicable only for XML transformation.
Provide the following information:
*Namespace Prefix. The namespace prefix of the payload expression to be validated.
For example, specify the namespace prefix as SOAP_ENV.
*Namespace URI. The namespace URI of the payload expression to be validated.
For example, specify the namespace URI as http://schemas.xmlsoap.org/soap/envelope/. This declaration defines SOAP_ENV as an alias for the namespace: http://schemas.xmlsoap.org/soap/envelope/.
Note:
You can add multiple namespace prefixes and URIs by clicking .