General Context Variables

The following table lists general predefined context variables available on the .
The following table lists general predefined context variables available on the
Layer7 API Gateway
XPATH results variables
For a list of the context variables created when evaluating an XPath expression, see:
  • Evaluate Request XPath Assertion
  • Evaluate Response XPath Assertion
For more information, see also Context Variables for XPaths.
WS-Addressing variables
For a list of the context variables created for WS-Addressing, see Require WS-Addressing Assertion.
JDBC connection variables
For a list of the context variables created during a JDBC connection, see Perform JDBC Query Assertion.
Non-SOAP XML element variables
For a list of the context variables created during a JDBC connection, see (Non-SOAP) Verify XML Element Assertion.
Contains the maximum allowable size of a document download. This variable is used in various cluster properties involving "maxSize" and "maxDownloadSize" (for example, wsdlDownload.maxSize). This variable contains the default value 10485760 bytes (10MB).
In this context variable, "gateway" is the context variable prefix that resolves a cluster-wide property value.
  • An administrator adds the property "company" with the value of "Acme Inc." in the cluster properties table. Assertions now have access to the context variable
    , which resolves to the value "Acme Inc.".
  • Define a cluster variable customersupport.phonenumber with the value 1-800-GET-ACME. You can then use this variable when creating a template SOAP fault in the Customize SOAP Fault Response assertion:
    <faultdetail> Please contact Support at ${gateway.customersupport.phonenumber} for assistance. </faultdetail>
Should the phone number ever change, you only need to edit the property value once and the change will be reflected in all policies that use this variable.
Returns a randomly-generated value of byte length [byte] and of type [type]. For example,
results in a 64 character hex string representing 32 bytes of output.
  • If [byte] is not specified, then the generated value can be of any byte length.
  • If [type] is not specified, then the value defaults to hexidecimal.
Valid data types include:
(signed BigInterger)
(unsigned BigInteger)
For more details, see "Generating Random Values" below.
Contains the reason for the last JSON schema validation failure(s). This is set by the Validate JSON Schema assertion.
Returns the unique identifier created for the request, within a given Gateway node. The identifier is comprised of two hexadecimal strings in this format:
  • The x symbols represent the date and time when Gateway service was started. This value is a zero-padded string.
  • The y symbols represent a sequential counter. This value is not a zero-padded string and it shows a value between 1 and the indicative length.
Typically, every request is associated with one unique request identifier. However, there may be instances where a single request can have more than one unique identifier—for example: HTTP Basic authentication credentials are missing in the initial request; a second request is initiated, which causes the
Layer7 API Gateway
to generate a new
. This results in the client having two different
for one initial request.
Contains the reason for the last schema validation failure. This is set by the Validate XML Schema assertion.
Works in conjunction with the trafficlogger.selective cluster property to determine whether traffic events will be logged.
If trafficlogger.selective = true, then the
Layer7 API Gateway
will check the ${} context variable:
  • If the variable is true, then traffic events will be logged.
  • If the variable contains any other value or is undefined, then traffic events will not be logged.
If trafficlogger.selective = false, all events are logged, provided that the traffic logger is enabled; the
variable is not consulted.
Contains the target to reference for CentraSite ActiveSOA UDDI Registry metrics. This value should match the value configured in the CentraSite web interface.
UDDI support is deprecated in
Layer7 API Gateway
Generating Random Values
You can use the ${gateway.random} variable to generate random numbers of various types to meet cryptographic security requirements. When used without suffixes, this variable returns of hexidecimal value of random bit length. You can limit the generate value to a specific bit length and data type.
Keep the following in mind when using this variable:
  • Using ${gateway.random} with or without the "hex" suffix results in hexidecimal values.
  • Do not use the exact same gateway.random suffixes more than once in a single expression, as they will all share the same value. For example, this expression will not generate a random IP address:
The above expression results in an IP address with the same octect repeated four times (for example, "" or "") instead of a random IP address such as "". Exception: Using ${gateway.random} by itself without suffixes will return different results, even if invoked multiple times within the same expression.
The workaround to the IP address example above is to create four separate variables and then append them. For example, use the Set Context Variable assertion four times to set ip1, ip2, etc., to
. Then, combine these variables with:
Set variable output = "${ip1}.${ip2}.${ip3}.${ip4}