Supported Versions: 10.0 & above
Introduction
You can use custom filter to invoke a service that is available on the webMethods API Gateway Server. You can use this capability to customize and invoke services in the webMethods API Gateway Server to perform actions such as custom authentication of external clients in the DMZ, logging or auditing in the DMZ, or implementation of custom rules for processing various payloads. Using the custom service implementation, you can extract the HTTP headers and payload from a request and act on it as per your business requirements. Upon processing the headers, you can forward the request to the internal server or deny the request and return an error message to the user. You can also use the pub.flow:setResponseHeaders and pub.flow:setResponseCode services to add custom headers to the response and to set customized response codes.
Things to remember
- Integration Server processes the incoming payload at webMethods API Gateway only if the custom logic in the service requires it to be processed.
- Use the pub.security.apigateway:customFilterSpec specification as the signature of the custom service.
- The custom filter is the last filter that the webMethods API Gateway Server checks while processing an API Gateway rule.
- An API Gateway rule that contains the custom filter that is enabled must be a denial rule. webMethods API Gateway Server automatically converts an alert rule into a denial rule when you enable the custom filter.
UI Configurations
For Custom filter, the ESB service should implement the "customFilterSpec". No other services are allowed as an input.
Workflow
(1) External clients send requests to webMethods API Gateway Server
(2) webMethods API Gateway Server collects client information from each request and evaluates the request against any rules (combination of filters in this case "Custom filter") that have been defined. API Gateway Server forwards the request to the service.
(3) Service processes the request, webMethods API Gateway Server either denies the request or allows the request.
(4) webMethods API Gateway Server then passes requests to the Internal Server.
(5) The Internal Server processes the requests and sends responses to webMethods API Gateway Server.
(6) webMethods API Gateway Server then passes the responses back to the client.
Runtime
ESB service using the sample "savePiplineToFile" which implements the "customFilterSpec" as show below
Execution showing the error message with 403 status configured for the filter,
Troubleshooting
S.No |
Error / Exception |
Message |
Possible Solution |
1. |
Error while saving custom filter |
There was an issue while creating the rule. com.wm.util.ValidationException: The node "xxxx" does not exist or is not a valid service node for custom filter. |
Choose the ESB service which implements the customFilter spec. (WmPublic -> pub -> security -> enterpriseGateway -> customFilterSpec) |
2. |
Error while accessing the service |
Access denied |
Make sure the ESB service is assigned with appropriate permissions. |