Conditional Routing
If you have a native API that is hosted at two or more endpoints, you can use the condition-based protocol to route specific types of messages to specific endpoints. The requests are routed according to the condition-based routing rules you create. For example, if your entry protocol is HTTP or HTTPS, you can select conditional routing specifying HTTP or HTTPS. A routing rule specifies where requests should be routed to, and the criteria to use to route. You may also specify how to authenticate requests.
The following table provides the existing options of routing till webMethods API Gateway version 10.5 and their corresponding variable syntax to choose the same option in webMethods API Gateway version 10.7.
10.5 Conditional Variable | 10.5 Condition Operator | 10.7 Transformation Variable | 10.7 Transformation Condition Operator |
---|---|---|---|
Consumer | ${request.application.id} | Equals | |
Date | Before
After |
${date} | Lesser than
Greater than |
Time | Before
After |
${time} | Lesser than
Greater than |
Predefined System Context Variables | |||
User
Inbound HTTP Method Routing Method Inbound Content Type Inbound Accept Inbound Protocol Inbound Request URI Inbound IP Gateway Hostname Gateway IP Operation Name |
Equal to
Not equal to |
${user}
${inboundHttpMethod} ${routingMethod} ${inboundContentType} ${inboundAccept} ${inboundProtocol} ${inboundRequestURI} ${inboundIP ${gatewayHostname} ${gatewayIP} ${operationName} |
Equals
Not equals |
Custom Context Variables | |||
mx:var1
PROTOCOL_HEADERS[KEY] SOAP_HEADERS[INDEX] |
Equal to Not equal to Lesser than Greater than |
${var1}
${request.headers.KEY} ${soapHeaders[INDEX} |
Equals
Not Equals Lesser than Greater than |
IPV4 | - | ${inboundIP} | Range |
IPV6 | - | ${inboundIP} | Range |
Property | Description |
---|---|
Route To. Specifies the URLs of two or more native services in a pool to which the requests are routed. | |
Endpoint URI | Specifies the URI of the native API endpoint to route the
request to in case all routing rules evaluate to False. Service registries that
have been added to the webMethods API Gateway instance are also included in the list. If you choose a service registry, webMethods API Gateway sends a request to the service registry to discover the IP address and port at which the native service is running. webMethods API Gateway replaces the service registry alias in the Endpoint URI with the IP address and port returned by the service registry. For example, if your service is hosted at the URL:
As this property supports variable framework, you can make use of the
available variables. For example, you can configure the endpoint URI using
hard coded URL, simple alias, endpoint alias, and variable syntax or any of
these combination. If you define the endpoint URI as
For details about the variables available in webMethods API Gateway, see Variables Available in API Gateway. Note: If you use endpoint alias, make sure the endpoint alias is created before
you define it in the policy. For example, if you define ${alias} syntax in the
policy before creating the alias as endpoint alias, webMethods API Gateway considers ${alias} as custom variable or
simple alias and tries to resolve against those. So in that case, after
creating endpoint alias you have to edit and save the API or policy to
associate ${alias} syntax with the endpoint alias.
|
HTTP Method | This is applicable to REST-based APIs. Specifies the available routing methods: GET, POST, PUT, DELETE, and CUSTOM (default). When CUSTOM is selected, the HTTP method in the incoming request is sent to the native service. When other methods are selected, the selected method is used in the request sent to the native service. Note: It is recommended to use Request Transformation > Method
Transformation to achieve this as other transformations can also
be done under the same policy.
|
SOAP Optimization Method | This is applicable for SOAP-based APIs.
Specifies the optimization methods that webMethods API Gateway can use to parse SOAP requests to the native API. Select one of the following options:
|
HTTP Connection Timeout (seconds) | Specifies the time interval (in seconds)
after which a connection attempt times out.
The precedence of the Connection Timeout configuration is as follows:
|
Read Timeout (seconds) | Specifies the time interval (in seconds)
after which a socket read attempt times out.
The precedence of the Read Timeout configuration is as follows:
|
Native Service Timeout (seconds) |
Specifies the time interval (in seconds) after which an HTTP connection attempt when calling the Integration Server HTTP backend service pub.client:http for REST APIs times out. The precedence of the Native Service Timeout configuration is as follows.
When a native service timeout is defined for an API, both the connection timeout and the read timeout values are set to the value of the native service timeout during the connection process to the native service. |
Pass WS-Security Headers | This is applicable for SOAP-based APIs.
Selecting this indicates that webMethods API Gateway should pass the WS-Security headers of the incoming requests to the native API. |
SSL Configuration. Configures keystore, key alias, and truststore for securing connections to native APIs. | |
Keystore Alias | Specifies the keystore alias configured
in
webMethods API Gateway.
This value (along with the value of Client Certificate Alias) is used for
performing SSL client authentication.
Lists all available keystores. If you have not configured any keystore, the list is empty. |
Key Alias | Specifies the alias for the private key, which must be stored in the keystore specified by the keystore alias. |
Truststore Alias | Specifies the alias for the truststore that contains the list
of CA certificates that webMethods API Gateway uses to validate the trust relationship with
the native API. If you do not configure any truststore alias, it implies that webMethods API Gateway does not validate the certificates provided by native APIs. |
Service Registry Configuration | |
Service Discovery Endpoint Parameter | Values required for constructing the
discovery service URI.
For example: if the service registry configuration of the service registry that you have selected in Endpoint URI has Service discovery path set to /catalog/service/{serviceName} (and the {serviceName} alias is intended for passing the service name), you must enter {serviceName} as Parameter and the name of the service as Value. As the Value field supports variable framework, you can make use of the available variables as path parameters. For example, if you provide a parameter as
{serviceName}( in
Service discovery path while you
define a service register) and the corresponding values for the path parameter
as
For details about the variables available in webMethods API Gateway, see Variables Available in API Gateway. |
Rule. Defines the routing decisions based on one of the following routing options. | |
Name | Provide a name for the rule. |
Condition Operator | Specifies the condition operator to be
used.
Select one of the following operators:
|
Add Condition | Specify the context variables for
processing client requests.
For details about the variables available in webMethods API Gateway, see Variables Available in API Gateway. |
Route To. Specifies the endpoint URI of native services in a pool to which the requests are routed. | |
Endpoint URI | Specifies the URI of the native API
endpoint to route the request to. You can use service registries in a similar
manner as described in the main
Endpoint URI above.
As this property supports variable framework, you can make
use of the available variables. For example, you can configure the endpoint URI
using hard coded URL, simple alias, endpoint alias, and variable syntax or any
of these combination. If you define the endpoint URI as
For details about the variables available in webMethods API Gateway, see Variables Available in API Gateway. Note: If you use endpoint alias, make sure the endpoint alias
is created before you define it in the policy. For example, if you define
${alias} syntax in the policy before creating the
alias as endpoint alias,
webMethods API Gateway
considers ${alias} as custom variable or simple alias and tries to resolve
against those. So in that case, after creating endpoint alias you have to edit
and save the API or policy to associate ${alias} syntax with the endpoint
alias.
|
HTTP Method | This is applicable for REST-based APIs.
Specifies the available routing methods: GET, POST, PUT, DELETE, and CUSTOM (default). When CUSTOM is selected, the HTTP method in the incoming request is sent to the native service. When other methods are selected, the selected method is used in the request sent to the native service. |
Soap Optimization Method | This is applicable for SOAP-based APIs.
Specifies values to enable SSL authentication for SOAP APIs. Select one of the following options:
|
HTTP Connection Timeout (seconds) | Specifies the time interval (in seconds)
after which a connection attempt times out.
The precedence of the Connection Timeout configuration is as follows:
|
Read Timeout (seconds) | Specifies the time interval (in seconds)
after which a socket read attempt times out.
The precedence of the Read Timeout configuration is as follows:
|
Native Service Timeout (seconds) |
Specifies the time interval (in seconds) after which an HTTP connection attempt when calling the Integration Server HTTP backend service pub.client:http for REST APIs times out. The precedence of the Native Service Timeout configuration is as follows.
When a native service timeout is defined for an API, both the connection timeout and the read timeout values are set to the value of the native service timeout during the connection process to the native service. |
Pass WS-Security Headers | This is applicable for SOAP-based APIs.
Selecting this indicates that webMethods API Gateway should pass the WS-Security headers of the incoming requests to the native API. |
SSL Configuration | Configures keystore, key alias, and
truststore for securing connections to native APIs.
Provide the following information:
|
Service Registry Configuration | |
Service Discovery Endpoint Parameter | Values required for constructing the
discovery service URI.
For example: if the service registry configuration of the service registry that you have selected in Endpoint URI has Service discovery path set to /catalog/service/{serviceName} (and the {serviceName} alias is intended for passing the service name), you must enter {serviceName} as Parameter and the name of the service as Value. As the Value field supports variable framework, you can make use of the available variables as path parameters. For example, if you provide a parameter as
{serviceName}( in
Service discovery path while you
define a service register) and the corresponding values for the path parameter
as
For details about the variables available in webMethods API Gateway, see Variables Available in API Gateway. |