Enforcing the scope of private variables when using the executeServiceByName JavaScript API

When you use the executeServiceByName JavaScript API, you can provide a map with input variables. If an input variable name is identical to the name of a private variable of the called service, the API overwrites the value of the private variable. To preserve the application data of the called service, you can enforce the scope of the private variables by configuring a property in the appropriate 100Custom.xml file in your topology.

About this task

You can add a configurable property in the appropriate 100Custom.xml file in your topology and set its value to true to display an exception if the executeServiceByName JavaScript API tries to overwrite a private or output variable of the called service. An administrator can use this information to handle the problem. When the exception occurs, the service engine writes the following message to the SystemOut.log file:
VariableDoesNotExistException: CWTBG0543E: The variable variableName does not exist.

Procedure

  1. Stop the server for Workflow Server or Workflow Center.
  2. Locate each 100Custom.xml file in your topology.
    For more information about the location of the 100Custom.xml file that must be updated, see the topic Location of 100Custom configuration files.
  3. Add the following code to the file:
    <server>
        <service-engine>            
            <enforce-private-variable-scope merge="replace">true</enforce-private-variable-scope>
        </service-engine>
    </server>
    
  4. Save your changes to each 100Custom.xml file.
  5. Start the server for Workflow Server or Workflow Center.