CentraSite Documentation : Runtime Governance with CentraSite : Using Context Variables in Virtual Services : The API for Context Variables : Sample Flow Service: Getting a Context Variable Value
Sample Flow Service: Getting a Context Variable Value
This flow service gets the value of a custom context variable from a request. The service declares a context variable using the name defined in the pipeline variable customName (that is, mx:COMP_TEST). It is hard-coded to store the predefined context variable SERVICE_NAME in this custom context variable name.
Step 1. Setting varName and customName
In this flow service, the following pipeline variables that are hard-coded as follows:
*varName is set to the predefined context variable SERVICE_NAME.
*customName is set to mx:COMP_TEST. SERVICE_NAME is stored in customName in the "Pipeline Out".
Step 2. Calling the pub.mediator.ctxvar:getContextVariable service
The call to pub.mediator.ctxvar:getContextVariable looks up the context variable value for the "Pipeline In" variable varName and sets the Serializable value in the output pipeline variable named serValue.
Step 3. Calling the pub.mediator.ctxvar:declareContextVariable service
The call to pub.mediator.ctxvar:declareContextVariable takes the serialized value we looked up for varName and assigns it to a newly declared custom context variable named ctxVar.
Step 4. Calling the pub.mediator.ctxvar:setContextVariable service
The call to pub.mediator.ctxvar:setContextVariable sets the context variable value back into MessageContext so it will be available for the rest of the service invocation steps.
Copyright © 2005-2015 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback