在带有 Enterprise Integration Pack 的 Azure 逻辑应用中验证用于 B2B 企业集成的 XMLValidate XML for B2B enterprise integration in Azure Logic Apps with Enterprise Integration Pack

通常在 B2B 方案中,协议中的贸易合作伙伴需确保他们交换的消息有效,才能开始处理数据。Often in B2B scenarios, the trading partners in an agreement need to make sure that the messages they exchange are valid before any data processing can start. 可以使用 XML 验证操作(随 Enterprise Integration Pack 提供)按照预定义的架构验证文档。You can validate documents against a predefined schema by using the XML validation action, which is available with the Enterprise Integration Pack.

必备条件Prerequisites

添加 XML 验证操作Add XML validation action

  1. Azure 门户的逻辑应用设计器中打开逻辑应用。In the Azure portal, open your logic app in the Logic App Designer.

  2. 如果有空白逻辑应用,请在逻辑应用设计器的搜索框中输入 HTTP request 作为筛选器,并选择“收到 HTTP 请求时” 触发器。If you have a blank logic app, in the Logic App Designer, in the search box, enter HTTP request as your filter, and select the When an HTTP request is received trigger. 否则,继续执行下一步。Otherwise, continue to the next step.

  3. 在工作流的最后一步,选择“新建步骤” 。Under the last step in your workflow, select New step.

    若要在现有步骤之间添加操作,请将指针移到连接这些步骤的箭头上方,以便显示加号 ( + )。To add an action between existing steps, move your pointer over the arrow that connects those steps so that the plus sign (+) appears. 选择该加号,然后选择“添加操作”。 Select that plus sign, and then select Add an action.

  4. 在“选择操作”下,选择“内置”。 Under Choose an action, select Built-in. 在搜索框中,输入 xml validation 作为筛选器。In the search box, enter xml validation as your filter. 从操作列表中选择“XML 验证” 。From the actions list, select XML Validation.

    找到并选择“XML 验证”操作

  5. 若要指定要验证的 XML 内容,请单击“内容”框以显示动态内容列表。 To specify the XML content that you want to validate, click inside the Content box so that the dynamic content list appears.

    打开动态内容列表

    动态内容列表显示了属性标记,这些标记表示工作流中前面步骤的输出。The dynamic content list shows property tokens that represent the outputs from the previous steps in the workflow. 如果列表不显示预期的属性,请检查触发器或操作标题,确定是否可以选择“查看更多” 。If the list doesn't show an expected property, check the trigger or action heading whether you can select See more.

  6. 从动态内容列表中,选择包含要验证的内容的属性。From the dynamic content list, select the property that has the content that you want to validate.

    此示例从触发器中选择“正文”输出。 This example selects the Body output from the trigger.

    选择要验证的内容

  7. 若要指定要用于验证的架构,请打开“架构名称” 列表,选择已添加到关联的集成帐户的验证架构。To specify the schema that you want to use for validation, open the Schema Name list and select the validation schema that you added to your linked integration account.

    选择要用于验证的架构

  8. 保存逻辑应用。Save your logic app.

    现在已完成验证设置。You're now done setting up your validation. 在实际应用中,可能需要将已验证的数据存储在业务线 (LOB) 应用(如 SalesForce)中。In a real world app, you might want to store the validated data in a line-of-business (LOB) app such as SalesForce. 要将已验证的输出发送到 Salesforce,请添加操作。To send the validated output to Salesforce, add an action.

  9. 若要测试验证操作,可以发送一个请求来触发逻辑应用的工作流。To test your validation action, you can send a request to trigger your logic app's workflow.

后续步骤Next steps