Use this task to write a filter to select a target service and port.
Why and when to perform this task
When a request is received by the gateway, it must determine what the target service really is, and what port to use to access that service.
The gateway represents each target service as a gateway service. Each gateway service can map to one or more target services, but without filters there is no point in mapping multiple targets because the gateway always picks the first one. If you want to map multiple targets, you also need to write pluggable filters that are configured for each gateway service and that can select the target service.
You write a filter as described in Writing a filter for the Web services gateway. Your filter can get the list of potential target services from the Routing service. It needs to select the target service, then call the Routing service to set the target service. This selection clears any prior selection of a target service port. Your filter might also use the Routing service to select the target port for the service invocation.
The Routing service provides a non-standard interface which is defined in the topic The Routing interface. The implementation of the Routing service is not pluggable.
The Home object for this service must implement the com.ibm.wsgw.beans.RoutingHome interface and be located in the Java Naming and Directory Interface (JNDI) in the websphere/WSGW/Routing directory.
This is the sequence of events for a filter to determine and set the target service:
Each target service is identified by the unique location of the target service definition, and by the target service identity information (which might not be unique). To select the target service, your filter can either get the table of mappings from target service location to identity information, then choose a target service to use; or it can call the setSelectedTargetServiceIdentity method with the required identity string (relying on the definition of the target service identity information). The routing service then selects the first target service it finds for the current gateway service that matches the specified identity information (using String.equals()).
When you use routing to set the target service or the target port, the Routing service updates the request context. Because the request context has changed, you then need to set the request object in the FilterAction object that you return from the filterRequest method (see the filter interface).