Message Routing Context Variables

The following table lists the predefined context variables related to message routing.
gateway83
The following table lists the predefined context variables related to message routing.
Variable
Description
${httpRouting.latency}
Returns the amount of time it took, in milliseconds, to send a request to its downstream endpoint and receive a response back.
This variable is only available after a message has been routed.
${httpRouting.reasonCode}
Returns a reason code that explains why the HTTP routing failed.
For a list of the reason codes, see HTTP Routing Response Codes.
${httpRouting.url}
Returns the Protected Service URL from the last routing assertion. This variable should be used after a routing assertion.
When used without a suffix, the entire URL is returned. When used with one of the following optional suffixes, only that part of the URL is returned:
  • .file
  • .fragment
  • .host
  • .path
  • .port
  • .protocol
  • .query
Examples:
${httpRouting.url}
returns the entire Protected Service URL
${httpRouting.url.host}
returns only the host name portion of the URL
The .file and .path suffixes will usually return the same values.
${rawtcp.reasonCode}
Sets the numeric value of the reason codes which are set regardless of the routing outcome. Below are the codes.
  • 0 (Success Route):
    Successfully routed.
  • -1 (Host Not Found):
    The server cannot be reached. This code is returned if either the host does not exist or the host is simply down.
  • -2 (Connection refused):
    The server does not accept the connection. An incorrect port number may have been used.
  • -3 (Socket timeout):
    No response was received before the connection timeout expired.
  • -4 (Data size limit exceeded):
    The message size has exceeded the data size limit.
  • -5 (Undefined):
    An unknown type of error has occurred.
This variable returns a value only after the Route via Raw TCP Assertion has run. The variable is not populated during normal HTTP routing.
${request.authorized}  
Returns "true" if one of the following conditions apply, otherwise returns "false":
  • ${request.completed} is true
  • a routing assertion was attemped and failed
  • a routing assertion completed with an error HTTP status
${request.completed}
Returns "true" if the service policy succeeded and routing completed successfully (or was absent from the policy); otherwise, returns "false".
${request.elapsedTime}
Returns the amount of time, in milliseconds, between receiving the request and the time the assertion that uses the variable is executed.
${request.routingTotalTime}
Returns the current cumulative time spend inside routing assertions since the request was received by the Gateway and the time the assertion that uses the variable is executed.
${routingStatus}
Returns the routing status:
  • None (-1):
    The policy contains no routing assertion or the routing assertion was never reached.
  • Attempted (0):
    The routing service was reached, but the message could not be routed successfully.
  • Routed (1):
    The routing assertion was able to successfully route the message.
${service.defaultRoutingURL}
This variable allows routing assertions to be updated when a service endpoint changes following a change in UDDI.
  • When the WSDL is under UDDI control, this variables holds the value of the accessPoint from the bindingTemplate from the UDDI registry. The variable is updated when there is a change in the UDDI.
  • When the
    API Gateway
    WSDL is not under UDDI control, this variable holds the value of the default routing URL from the WSDL.
The value of this variable is used in the routing assertion when publishing a new SOAP service.
This context variable is read only .
${service.url}
This context variable has been replaced by the variable
${httpRouting.url}
. Though this variable still works, it is highly recommended that you adjust your service policies to use the new variable instead.