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
- Drag the Advanced icon to the
configuration path.
- Double-click the Advanced
icon.
- From the action list, select Conditional.
- Click Next.
- In the Input field, specify the context of the
message to process.
- 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.
- Create the action to run when the match condition evaluates
to
true
. This action is known as the conditionally
run action.
- Select the action type from the Action list.
- Click Create action.
- 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.
- Click Done.
- 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.
- 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.
- 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.