How to set a default response when a service cannot be found

Document ID : KB000009737
Last Modified Date : 26/10/2018
Show Technical Document Details

When attempting to reach a gateway service that either does not exist or is otherwise unable to be resolved the below error is returned by default.


<l7:policyResult xmlns:l7="" status="Service Not Found. The request may have been sent to an invalid URL, or intended for an unsupported operation."/>

To customize the message returned to end users a catch all policy can be configured

1. Launch policy manager

2. Publish a Web API

    [9.1] Tasks Menu -> Service and APIs -> Publish Web API

    [9.0 and under] Tasks -> Publish Web API

3. Enter the resolution path as an asterisk (*). This will catch all calls at the root of the Gateway.

Publish API

4. Click finish

5. You can now write a policy to suite your needs. Common uses are using a 'Return Template Response' assertion with an HTTP error code and status message such as:

Template response