CentraSite Documentation : Runtime Governance with CentraSite : Using Context Variables in Virtual Services : The API for Context Variables : Sample Flow Service: Setting a Context Variable Value
Sample Flow Service: Setting a Context Variable Value
This flow service sets the value of a custom context variable to be used in a response.
This flow service declares a pipeline variable named customName, which is set to the value mx:COMP_TEST.
This flow service will retrieve the context variable for customName and create an element for its context variable value in the response message return to the consumer.
Figure 29. Step 1. Declaring customName
We define the customName variable value to be mx:COMP_TEST so we can use this variable to lookup the custom variable name that was seeded in the previous example.
Figure 30. Step 2. Setting customName to mx:COMP_TEST
Clicking on the customName pipeline variable will display the name.
Figure 31. Step 3. Displaying the value of customName
The call to pub.mediator.ctxvar:getContextVariable retrieves the value of the custom context variable from the context variable map.
Figure 32. Step 4. Calling meditor.ctxvar:getContextVariable
This is just a sample Java service that takes the context variable and creates a top-level element in the response message using the same name and value.
Figure 33. Step 5. Sample service using the context variable
Copyright © Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback