Adding a conditional action

A conditional action implements programmatic if-then-else processing.

About this task

If the XPath expression returns true when applied to the input context, a designated processing action runs. Any number of if-then clauses can be configured. A final else clause that uses an empty XPath expression () runs a designated action when no other XPath expression matches the input.

You can designate a call processing rule action. You can use this action to run a complete processing rule that contains one or more actions. You can configure a conditional action to provide the same service as a complete processing policy, which gives you the ability to run different processing policies conditionally on input.

Procedure

  1. Drag the Advanced icon to the configuration path.
  2. Double-click the Advanced icon.
  3. From the action list, select Conditional.
  4. Click Next.
  5. In the Input field, specify the context of the message to process.
  6. In the Match condition field, enter The XPath expressions apply to the data in the context selected.
    Click XPath tool for assistance in constructing the expression.
  7. Create the action to run when the match condition evaluates to true.
    This action is known as the conditionally run action.
    1. Select the action type from the Action list.
    2. Click Create action.
    3. Configure the new action.
      Consider the following points.
      • The input context of the conditionally run action can be different from the input context of the conditional action itself. Typically, the input context of the conditionally run action is the same as the conditional action.
      • This action can operate in any manner, including as a filter that either accepts or rejects the message, thus continuing or halting the processing of the processing rule. Examples include signature verification, custom filtering, and AAA actions.
      • This action can be a call processing rule action, allowing the processing of an entire processing rule.
      • This action cannot be the conditional action. A recursive conditional action cannot be run. This action can be a different conditional action that does not contain a loop back to this conditional action.
      • The output context of this action can take any valid value, including OUTPUT.
      • This action can run asynchronously. However, when this action is configured to run asynchronously, the action that follows the conditional action is run immediately. Any action that follows the conditional action cannot use the output context of the asynchronous action as its input context.
    4. Click Done.
  8. Optional: Repeat the previous step as many times as wanted.
    Note the following points.
    • The action evaluates the statements in sequential order. The first statement that matches is run. Use the arrows to reorder the list. Click X to delete a statement.
    • To create an else condition, create the last statement with a universal matching condition, such as /*. This condition ensures that if all other matching conditions fail to match, the last statement runs.
    • If no statement matches, the conditional action completes without running any action.
  9. Set the Asynchronous property to indicate whether to process asynchronously. When enabled, the action does not need to complete before the rule starts processing its next action.
  10. Click Done.

Results

The conditional action requires no output context. To use the output of the conditionally run action, the action that follows the conditional action must use as its input context the output context of the conditionally run action. For example, a conditional action can run one of a range of transform actions that are based on the match condition that applies to the request message. Each transform action uses custvar1 as the output context. The first action in the processing rule after the conditional then uses custvar1 as the input context.

What to do next

If this action is the last one for the rule, click Apply policy. Otherwise, drag another icon to the configuration path.