Skip To Content

添加和配置“发送 Web 请求”

“发送 Web 请求”步骤用于将请求发送至 REST 端点以获取数据或提交更新。 如果 Workflow Manager 已使用 ArcGIS Workflow Manager Server Advanced 角色进行许可,则可以将 REST 端点的响应配置为自定义输出值,将其另存为文件以及将其附加到作业。 自定义输出值可用于调用后续 REST 调用的令牌,确定工作流遵循的路径或用作整个工作流中其他步骤的输入

运行步骤时,web 请求将发送至在步骤中定义的 REST 端点。

可通过单击完成步骤按钮 Complete Step 完成步骤。

配置步骤

To configure the step, do the following:

警告:

为了减少安全漏洞,仅为受信任的 web 页面和 web 应用程序配置“发送 Web 请求”步骤。

  1. Create or edit a workflow diagram to access the Step Library panel.
  2. 发送 Web 请求步骤库面板拖至工作流画布上步骤的连接箭头。

    The Step Details panel appears.

  3. Provide a name for the step in the Step Name text box.
  4. 参数部分中,单击编辑
  5. 单击 URL 下拉箭头,然后选择要发送的请求类型。
  6. URL 文本框中键入 REST 端点的 URL。
  7. (可选)使用以下语法将路径变量添加至 URL:
    https://gisserver.domain.com/webadaptorname/apps/workflowmanager/:pathVariable/

    路径变量部分中将显示路径变量。

  8. 如果已将路径变量添加至 URL,在路径变量部分中为每个变量提供值。

    You can also use ArcGIS Arcade expressions to provide a dynamic value.

    提示:

    Click the This input supports Arcade Expressions button This input supports Arcade expressions and choose an ArcGIS Arcade expression to add it to its associated text box.

  9. 或者,将查询参数添加至 web 请求。
    1. 查询参数部分中单击添加键和值
    2. 文本框中提供键。

      You can also use ArcGIS Arcade expressions to provide a dynamic value.

    3. 文本框中提供值。

      You can also use ArcGIS Arcade expressions to provide a dynamic value.

    4. 保持选中已启用复选框。
    5. 重复子步骤 a 至 d 添加更多键值对。
  10. 单击授权选项卡。
  11. 选择 REST 端点的身份杨峥方法,然后根据需要提供身份验证信息。
    警告:

    在步骤中提供的身份验证信息未加密。 要确保信息安全,添加已加密用户定义设置以存储信息并使用动态作业属性在步骤中进行引用。

    1. 或者,如果选择 API 密钥Bearer 令牌选项,单击或者从端点生成令牌

      随即显示从端点生成令牌对话框。

    2. 配置令牌设置以生成 Web 请求的令牌。
  12. 或者,单击标题选项卡将自定义标题键值对添加至 Web 请求。
    1. 自定义标题部分中单击添加键和值
    2. 文本框中提供键。

      You can also use ArcGIS Arcade expressions to provide a dynamic value.

    3. 文本框中提供值。

      You can also use ArcGIS Arcade expressions to provide a dynamic value.

    4. 保持选中已启用复选框。
    5. 重复子步骤 a 至 d 添加更多键值对。
  13. 或者,单击正文选项卡将数据添加至 Web 请求。

    请求正文支持表单数据键值对、URL 编码的键值对以及采用 JSON 或纯文本格式的原始数据。

    提示:

    还可以使用 ArcGIS Arcade 表达式调用用户定义设置或在正文文本中提供动态值

  14. (可选)如果具有 ArcGIS Workflow Manager Server Advanced 的许可,配置步骤的输出设置
  15. (可选)单击测试选项卡,然后单击测试响应发送配置的请求并显示其响应。

    如果 Web 请求包含作业特定 Arcade 表达式,必须打开包含作业 ID,然后在作业 ID 文本框中提供作业 ID 以正确格式化请求。

  16. 单击保存关闭配置 Web 请求对话框。
  17. Click the Options tab.
  18. Configure Step Options as necessary.
    • Manual—Run the step manually.
      • Optional—Allow the step to be finished without being run.
    • Automatic—Run the step as soon as it becomes active.
      注:

      If your workflow diagram is configured to automatically run a sequence of steps that includes the Evaluate Data Quality or the Run GP Service step, steps that attempt to run after the user token that started the sequence of steps expires will not run automatically. You must have a license for the ArcGIS Workflow Manager Server Advanced role to continue running the additional automated steps without manual intervention.

    • Run on a Schedule—Run the step according to a schedule you set.

      Learn more about scheduling options

  19. Optionally, provide help text for the step in the Step Help text box.

    You can also use ArcGIS Arcade expressions to provide a dynamic value for the step help. If the step help contains plain text and Arcade expressions, you'll need to format the text as follows:

    'For further assistance, please contact ' + JobCreator($Job) + '.'

  20. Optionally, click the Style tab to change the shape and color of the step.
  21. Optionally, click the About tab and provide a description for the step in the Step Description text box.
    注:

    The About tab also contains the step's ID that can be used with dynamic job properties to obtain a step's output.

配置令牌设置

如果 REST 端点需要令牌才能进行身份验证,按照以下步骤将“发送 Web 请求”步骤配置为生成可用于对 Web 请求进行身份验证的令牌。

  1. 单击 URL 下拉箭头,然后选择要发送的请求类型。
  2. URL 文本框中键入 REST 端点的 URL。
  3. 或者,将查询参数添加至 web 请求。
    1. 查询参数部分中单击添加键和值
    2. 文本框中提供键。

      You can also use ArcGIS Arcade expressions to provide a dynamic value.

    3. 文本框中提供值。

      You can also use ArcGIS Arcade expressions to provide a dynamic value.

    4. 保持选中已启用复选框。
    5. 重复子步骤 a 至 d 添加更多键值对。
  4. 或者,单击标题选项卡将自定义标题键值对添加至 Web 请求。
    1. 自定义标题部分中单击添加键和值
    2. 文本框中提供键。

      You can also use ArcGIS Arcade expressions to provide a dynamic value.

    3. 文本框中提供值。

      You can also use ArcGIS Arcade expressions to provide a dynamic value.

    4. 保持选中已启用复选框。
    5. 重复子步骤 a 至 d 添加更多键值对。
  5. 或者,单击正文选项卡将数据添加至 Web 请求。

    请求正文支持表单数据键值对、URL 编码的键值对以及采用 JSON 或纯文本格式的原始数据。

    提示:

    还可以使用 ArcGIS Arcade 表达式调用用户定义设置或在正文文本中提供动态值

  6. 单击令牌选项卡。
  7. 令牌部分中,单击测试模式开关按钮。
  8. 示例响应文本框中粘贴 REST 端点响应的示例。

    采用 JSON 格式的示例响应:

    {"access_token": "12345abcde",
    "expires_in":7199,
    "spatialReference": {
      "wkid": 4326,
      "latestWkid": 4326
    },
    "locations": [
      {
        "name": "380 New York Street",
        "extent": {
          "xmin": -117.196701,
          "ymin": 34.055489
        }
      }
    ]}
  9. 输出值文本框中,提供令牌的名称。

    这是步骤用于引用生成的令牌的名称。

  10. 提供采用点表示法或括号表示法的 JSONPath 表达式,以解析响应并返回生成的令牌。

    采用点表示法的示例 JSONPath:

    $.access_token

    采用括号表示法的示例 JSONPath:

    $['access_token']

    值将在示例结果列中显示。

  11. 单击返回步骤配置以继续配置步骤。

配置输出设置

许可:

This functionality requires a license for the ArcGIS Workflow Manager Server Advanced role.

ArcGIS Workflow Manager Server Advanced 角色允许将 REST 端点响应另存为文件,将其附加到作业以及将其配置为自定义输出值。 输出值可用于确定工作流遵循的路径或用作整个工作流中其他步骤的输入。 如果没有配置步骤的输出值,HTTP 状态代码将存储为步骤的输出值。 要配置步骤的输出设置,执行以下操作:

  1. 配置 Web 请求对话框中,单击输出选项卡。

    如果配置 Web 请求对话框不可用,单击工作流画布上的发送 Web 请求步骤,然后在步骤详细信息面板的参数部分中单击编辑

  2. (可选)在附加响应部分中单击已启用开关按钮,将 REST 端点响应另存为文件并将其附加到作业。
  3. (可选)执行以下步骤配置附件名称和存储附件的文件夹:
    1. 文件夹名称文本框中提供存储附件的文件夹的名称。

      文件夹名称不能包含文件系统路径或特殊字符。 如果未提供文件夹名称,将自动创建名为 General 的文件夹。

      注:

      文件夹包含在工作流项目中,并且不是文件系统路径。

    2. 选择以下附件名称选项之一:
      • 自动生成 - 使用以下语法自动对附件进行命名:<StepName>_<RunDate>_<RunTime>
      • 自定义 - 允许提供自定义附件名称
  4. (可选)执行以下步骤为 REST 端点响应配置自定义输出值:
    1. 输出值部分中单击测试模式开关按钮。
    2. 示例响应文本框中粘贴 REST 端点响应的示例。

      采用 JSON 格式的示例响应:

      {"access_token": "",
      "expires_in":7199,
      "spatialReference": {
        "wkid": 4326,
        "latestWkid": 4326
      },
      "locations": [
        {
          "name": "380 New York Street",
          "extent": {
            "xmin": -117.196701,
            "ymin": 34.055489
          }
        }
      ]}
    3. 单击添加输出和路径
    4. 输出值文本框中提供输出值的名称。

      这是用于获取自定义输出值的值名称。

    5. 提取路径文本框中为要存储的值提供采用点表示法或括号表示法的 JSONPath 表达式。

      采用点表示法的示例 JSONPath:

      $.locations.0.name

      采用括号表示法的示例 JSONPath:

      $['locations'][0]['name']

      值将在示例结果列中显示。

    6. (可选)重复步骤 c 至 e 添加更多自定义输出值。
  5. 单击保存关闭配置 Web 请求对话框。

Return value

When the step is completed, its return value is stored to indicate the result of the step. The return value can be immediately evaluated using paths to determine the next steps in the workflow. You can also retrieve the return value for completed steps throughout the workflow using ArcGIS Arcade expressions. The following table lists the step's return values:

Return valuesDescription

S000001

The step completed successfully.

F000001

The step failed to complete successfully.

输出值

许可:

This functionality requires a license for the ArcGIS Workflow Manager Server Advanced role.

When the step is completed, its output value is stored and can be used to determine the path the workflow follows or be used as inputs for other steps throughout the workflow. The following table shows the step's output value:

输出描述

状态

如果没有未步骤配置输出值,返回 HTTP 响应代码。

<CustomOutputValue>

返回之前为步骤配置的自定义输出值。

相关主题