CentraSite Documentation : Runtime Governance with CentraSite : Using Context Variables in Virtual Services : The API for Context Variables : pub.mediator.ctxvar:declareContextVariable
pub.mediator.ctxvar:declareContextVariable
Use this Java service to declare a custom context variable. All custom-defined context variables must be declared in a custom namespace that is identified by using the prefix mx (for example, mx:CUSTOM_VARIABLE). All parameter names are case-sensitive.
Note:  
It is not legal to use this service to declare the predefined context variables; you can only declare custom variables.
Parameter
Pipeline Type
Data Type
Description
ctxVar
in
Object ref
The document type defining the context variable object. Use the ctxVar Document Type provided in the Java service pub.mediator.ctxvar:ctxVar and map it to this input variable. Define the name (for example, mx:CUSTOM_VARIABLE), the schema_type (string or int), and isReadOnly (true or false).
ctxVar
out
Object ref
The set Context variable document type.
varNameQ
out
Object ref
javax.xml.namespace.QName value. The QName of the variable.
Note the following:
*After declaring the context variable, you can use the setContext variable to set a value on the context variable.
*You do not need to declare the following kinds of context variables:
*The predefined context variables provided by Mediator. If you attempt to declare an existing predefined context variable, an error will occur.
*Any custom context variable that you define in a routing rule that you create in the context-based routing step.
*Any custom context variables that you explicitly declare in source code using the API will have a declaration scope of SESSION.
*Any custom context variable's state that is defined during the inbound request processing steps will still be available during the outbound response processing steps.
*All context variable values are typed as either "string" or "int" (excluding the SOAP_HEADERS and PROTOCOL_HEADERS variables, which are of the type "IData").
*Valid names should be upper case (by convention) and must be a valid Java Identifier. In general, use alpha-numerics, $ or _ symbols to construct these context names. Names with punctuation, whitespace or other characters will be considered invalid and will fail deployment.
*All custom context variables must be declared in a custom namespace that is identified by using an mx prefix (for example, mx:CUSTOM_VARIABLE).
*To reference a custom context variable in a flat string, you need to prepend a $ symbol to the context variable name to indicate that variable’s value should be referenced. Think of this usage as being similar to the ‘&’ address operation for C variables.
An expression that references a custom context variable might look like this:
$mx:TAXID=1234 or $mx:ORDER_SYSTEM_NAME="Pluto"
Notice that the values of the data type “int” are not enclosed in quotation marks, while the values of the data type “string” are. The quotation marks are only needed if a context variable expression (as opposed to a reference) is defined.
*Referencing an undefined context variable does not result in an error.
*Once a variable has been declared it cannot be declared again.
Copyright © 2005-2015 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback