相关文章推荐
爱健身的红烧肉  ·  pipenv : ...·  昨天    · 
淡定的打火机  ·  用Python更新MS Word ...·  2 年前    · 
爱吹牛的冲锋衣  ·  c++ - ...·  2 年前    · 
另类的核桃  ·  c# - How to sign a ...·  2 年前    · 

REST 请求节点支持许多本地环境消息树变量,可以使用这些变量动态变更该节点的属性中设置的值。

下表显示了 LocalEnvironment.Destination.REST.Request 消息树中的元素,这些元素可用于覆盖 RESTRequest RESTAsyncRequest 节点中的属性。 局部环境变量设置的任何属性都将应用于 RESTRequest RESTAsyncRequest 节点。

该表包含如何使用 ESQL 设置值的示例; 但是,您还可以使用变换节点 (例如, Mapping 节点) 来设置这些值。 要从 映射 节点访问 LocalEnvironment ,请参阅 定制消息映射以包含消息组合件组件
表 1. 输入本地环境属性
指定要用于操作参数的值。 在 LocalEnvironment 中指定的值将覆盖节点上 Parameters 表中指定的任何字面值或 XPath/ESQL 表达式。 例如:
SET OutputLocalEnvironment.Destination.REST.Request.Parameters.max = 10;
SET OutputLocalEnvironment.Destination.REST.Request.Parameters.filter = 'Fred Bloggs';
注: 如果值是 XPath/ESQL 表达式,那么值将作为字符串字面值 (而不是作为 XPath/ESQL 表达式进行求值) 传递到远程 REST API。

要定义 REST 参数并在消息映射中设置其值,请使用 Add User Defined 函数来添加 parameter_name 元素,然后提供映射以设置其值。 有关更多信息,请参阅 使用 "添加用户定义的函数" 配置局部环境树 Variables 文件夹

指定用于所指定安全方案的安全身份的名称。 指定的安全身份仅用于指定的安全方案。

如果指定了此环境变量,那么它将覆盖节点上的 LocalEnvironment.Destination.REST.Request.SecurityIdentity 覆盖和 Security identity 属性。

安全方案的名称与包含 REST API 定义的 Swagger 文档中安全定义对象内安全方案对象的名称相对应。

该值必须是使用 mqsisetdbparms 命令定义的安全身份的名称。 请勿包含“rest::”前缀。 例如:

SET OutputLocalEnvironment.Destination.REST.Request.SecuritySchemes.petstore_auth.SecurityIdentity = 'myIdentity3' 
指定要在使用 HTTP 基本认证时用于所指定安全方案的用户标识。 指定的用户标识仅用于指定的安全方案。

如果指定了此环境变量,那么它将通过 LocalEnvironment.Destination.REST.Request.SecuritySchemes. security_scheme .SecurityIdentity LocalEnvironment.Destination.REST.Request.SecurityIdentity 覆盖来覆盖在安全身份中指定的用户标识,同时还会覆盖节点上的 Security identity 属性。

安全方案的名称与包含 REST API 定义的 Swagger 文档中安全定义对象内安全方案对象的名称相对应。 例如:
SET OutputLocalEnvironment.Destination.REST.Request.SecuritySchemes.security_scheme.UserID='bob' 
指定要在使用 HTTP 基本认证时用于所指定安全方案的密码。 指定的密码仅用于指定的安全方案。

如果指定了此环境变量,那么它将通过 LocalEnvironment.Destination.REST.Request.SecuritySchemes. security_scheme .SecurityIdentity LocalEnvironment.Destination.REST.Request.SecurityIdentity 覆盖来覆盖在安全身份中指定的密码,同时还会覆盖节点上的 Security identity 属性。

安全方案的名称与包含 REST API 定义的 Swagger 文档中安全定义对象内安全方案对象的名称相对应。 例如:
SET OutputLocalEnvironment.Destination.REST.Request.SecuritySchemes.petstore_auth.Password='myPassword' 
指定要在使用 HTTP 基本认证时用于所指定安全方案的 API 密钥。 指定的 API 密钥仅用于指定的安全方案。

如果指定了此环境变量,那么它将通过 LocalEnvironment.Destination.REST.Request.SecuritySchemes. security_scheme .SecurityIdentity LocalEnvironment.Destination.REST.Request.SecurityIdentity 覆盖来覆盖在安全身份中指定的 API 密钥,同时还会覆盖节点上的 Security identity 属性。

安全方案的名称与包含 REST API 定义的 Swagger 文档中安全定义对象内安全方案对象的名称相对应。 例如:
SET OutputLocalEnvironment.Destination.REST.Request.SecuritySchemes.petstore_auth.APIKey='438438920909329039032'
指定要由 RESTAsyncRequest 节点存储的上下文数据。 稍后可由 RESTAsyncResponse 节点针对匹配请求访问数据。

您可以使用用户上下文来指定将从 RESTAsyncRequest 节点传递到 RESTAsyncResponse 节点的数据。 要存储用户上下文数据,请在 RESTAsyncRequest 节点之前,在 OutputLocalEnvironment.Destination.REST.Request.UserContext 环境变量中设置值,或者在其下创建并填充子节点。

例如,要使用 ESQL 表达式来设置值:
SET OutputLocalEnvironment.Destination.REST.Request.UserContext = 'Some important information';
SET OutputLocalEnvironment.Destination.REST.Request.UserContext.Name.FirstName = 'Fred';
SET OutputLocalEnvironment.Destination.REST.Request.UserContext.Name.Surname = 'Bloggs';
SET OutputLocalEnvironment.Destination.REST.Request.UserContext.MyData.Binary = CAST('A piece of data' AS BLOB CCSID 1208);

您可以使用 映射 节点通过映射到混合子元素 OutputLocalEnvironment.Destination.REST.Request.UserContext.mixed 来设置值。 要使用 映射 节点来创建子元素,请使用用户定义的元素或强制类型转换 xsd:any 并映射到这些元素。 有关更多信息,请参阅 RESTAsyncRequest 节点

要在 RESTAsyncResponse 节点之后访问用户上下文数据,请读取 LocalEnvironment.REST.Response.UserContext 环境变量的值或子代。

在查询字符串中指定在构建 URI 时不对其进行百分比编码的字符。
例如,要指定不对逗号和大于号进行百分比编码:
SET OutputLocalEnvironment.Destination.REST.Request.QueryStringDoNotPercentEncodeCharacters = ',>';

不进行百分比编码的缺省字符集是星号 ( * )、减号 ( - )、句点 ( . ) 和下划线 ( _ )。

  • 连接客户机应用程序
  • 使用 RESTRequest 节点调用 REST API
  • 通过使用 RESTAsyncRequest 和 RESTAsyncResponse 节点与 REST API 进行异步交互
  • 连接到外部 REST API
  •