在使用 executeServiceByName JavaScript API 时实施专用变量的范围

在使用 executeServiceByName JavaScript API 时,您可以为映射提供输入变量。如果输入变量名称与所调用服务的专用变量的名称相同,那么 API 覆盖专用变量的值。要保留调用的服务的应用程序数据,您可以通过在拓扑的相应 100Custom.xml 文件中配置属性,来实施专用变量范围。

关于此任务

您可以在拓扑的相应 100Custom.xml 文件中添加可配置的属性,并将其值设置为 true 以在 executeServiceByName JavaScript API 尝试覆盖调用的服务的专用或输出变量时显示异常。管理员可以使用此信息来处理问题。在发生异常时,服务引擎将以下消息写入 SystemOut.log 文件:
VariableDoesNotExistException: CWTBG0543E: The variable variableName does not exist.

过程

  1. 停止 Process Server 或 Process Center 服务器。
  2. 查找拓扑中的每个 100Custom.xml 文件。 有关必须更新的 100Custom.xml 文件的位置的更多信息,请参阅主题100Custom 配置文件的位置
  3. 将以下代码添加到该文件:
    <server>
        <service-engine>
            <enforce-private-variable-scope merge="replace">true</enforce-private-variable-scope>
        </service-engine>
    </server>
  4. 保存对每个 100Custom.xml 文件的更改。
  5. 启动 Process Server 或 Process Center 服务器。