Configuring inject parameters
NSM service designers can configure inject parameters in the NSM service template XML and their values are populated by evaluating the results of functions when the service is executed.
Procedure
- As the NSM service
designer use
the following example as a guide to configuring inject parameters:
<injectParameters> <injectParameter> <name>FULL_ZONE_NAME</name> <methodCall>concat</methodCall> <arguments>CON01,ZONE_NAME</arguments> </injectParameter> </injectParameters>
Note: The<injectParameters>
and</injectParameters>
elements encapsulate one or more<injectParameter>
elements.- Enter the required inject parameter name in the
<name>
tag associated with each instance of the<injectParameter>
XML element. In the example one inject parameter is defined:FULL_ZONE_NAME
. - Enter the required predefined function name in the
<name>
tag associated with each instance of the<methodCall>
tag. In the example one predefined function is specified:concat
. - Enter the required arguments for the predefined function
in the
<arguments>
tag associated with each instance of the<methodCall>
tag. In the example two arguments are specified for theconcat
predefined function:CON01
andZONE_NAME
.When the service is executed, the results of functions are evaluated.
- Enter the required inject parameter name in the
- If a predefined NSM function is not available for the method
that you are trying to complete, then as the NSM service
designer,
write your own JavaScript function and insert it in the
code
tag, for example:<injectParameters> <injectParameter> <name>FULL_ZONE_NAME</name> <methodCall>concat_alternative</methodCall> <arguments>CON01,ZONE_NAME</arguments> <code>function concat_alternative(target, append) { testNotNull(target,"concat","target"); testNotNull(target,"concat","append"); var x = target + append; return x; }</code> </injectParameter> </injectParameters>
When the service is executed the results of the JavaScript function are evaluated.Observe the following points when working with inject parameters:
- Inject parameters are populated by evaluating the results of functions. There are two types of functions that can be used: predefined NSM functions and user defined JavaScript functions.
- Inject parameters (that is the predefined functions and JavaScript functions) are evaluated when the service is executed.
- When the service is run, the value is used where the inject parameter is referenced.
- Inject parameter values are then used where the parameters are referenced.
- Inject parameters can be used as both global and local parameters in a NSM service template.