Websydian v6.1 online documentationOnline documentation - WebsydianExpress v3.0

SelectionCriteriaProgram

Scoped name

Abstract.SelectionCriteriaProgram

Purpose

The SelectionCriteriaProgram enables you to create you own functionality for selecting a ServiceHandler to process a service request, without having to create your own ServiceProcessor.

The SelectionCriteriaProgram is called by the implemented ServiceProcessor functions when you specify the selection criterion "Program".

By inheriting from the abstract SelectionCriteriaProgram, information about the request is made available in the local variable RequestInformation.

In the program, you code your own logic for identifying the ServiceHandler function you want to call for the processing of your request.

Usage

Create a function that inherits from this abstract function if you specify criteria of the type "Program". When you specify the "Program" criterion in the service structure, you will be prompted for a program name - specify the implementation name of the implemented function.

In the function, you can create your own logic for selecting a handler to process the request.

You must return the unique identification of the handler to call (ServiceHandlerSurrogate) to the service processor.

You can find information about the service structure by using the API's GetURLAndServiceProcessor, GetCriteriaForURL, and FindOfferedService. To make it possible to use these API's, the identification of the ServiceURL that is currently used is available in the input parameter of the function.

Examples

One example of this could be if you need information about several http-headers to identify the correct handler to call (the standard http header criterion only allows for one header to be evaluated).

In the implemented function you can retrieve the value specified for each of the relevant headers using the WSYBASE/GetHeaderOrEnvironmentVariable function - and create the logic that uses the values for these header to identify the suitable handler.

Special considerations

SelectionCriteriaPrograms are called dynamically based on the definitions in the service structure. This means that you may not change the interface of the implemented functions.

More information

Background: Understanding the service structure

Background: Handling web service requests

Background: Selection Criteria

API: GetURLAndServiceProcessor

API: GetCriteriaForURL

API: FindOfferedService