在带有 Enterprise Integration Pack 的 Azure 逻辑应用中使用架构验证 XMLValidate XML with schemas in Azure Logic Apps with Enterprise Integration Pack

若要检查文档是否使用有效的 XML 并包含适用于 Azure 逻辑应用中企业集成方案的预定义格式的所需数据,逻辑应用可以使用架构。To check that documents use valid XML and have the expected data in the predefined format for enterprise integration scenarios in Azure Logic Apps, your logic app can use schemas. 架构还可以验证逻辑应用在企业到企业 (B2B) 方案中交换的消息。A schema can also validate messages that logic apps exchange in business-to-business (B2B) scenarios.

有关集成帐户和架构等项目的限制,请参阅 Azure 逻辑应用的限制和配置信息For limits related to integration accounts and artifacts such as schemas, see Limits and configuration information for Azure Logic Apps.

先决条件Prerequisites

创建和添加架构时不需要逻辑应用。You don't need a logic app when creating and adding schemas. 但是,若要使用架构,逻辑应用需要链接到存储该架构的集成帐户。However, to use a schema, your logic app needs linking to an integration account where you store that schema. 了解如何将逻辑应用链接到集成帐户Learn how to link logic apps to integration accounts. 如果没有逻辑应用,请了解如何创建逻辑应用If you don't have a logic app yet, learn how to create logic apps.

添加架构Add schemas

  1. 使用 Azure 帐户凭据登录到 Azure 门户Sign in to the Azure portal with your Azure account credentials.

  2. 若要查找并打开集成帐户,请在 Azure 主菜单中选择“所有服务”。 To find and open your integration account, on the main Azure menu, select All services. 在搜索框中,输入“集成帐户”。In the search box, enter "integration account". 选择“集成帐户”。 Select Integration accounts.

    查找集成帐户

  3. 选择要将架构添加到的集成帐户,例如:Select the integration account where you want to add your schema, for example:

    选择“集成帐户”

  4. 在集成帐户的“概述”页上的“组件”下,选择“架构”磁贴。 On your integration account's Overview page, under Components, select the Schemas tile.

    选择“架构”

  5. “架构”页打开后,请选择“添加”。 After the Schemas page opens, choose Add.

    选择“添加”

根据架构 (.xsd) 文件的大小,遵循相应的步骤来上传不超过 2 MB大于 2 MB 但不超过 8 MB 的架构。Based on your schema (.xsd) file's size, follow the steps for uploading a schema that's either up to 2 MB or more than 2 MB, up to 8 MB.

添加不超过 2 MB 的架构Add schemas up to 2 MB

  1. 在“添加架构”下,输入架构的名称。 Under Add Schema, enter a name for your schema. 将“小文件”保持选定状态。 Keep Small file selected. 选择“架构”框旁边的文件夹图标。 Next to the Schema box, choose the folder icon. 找到并选择要上传的架构,例如:Find and select the schema you're uploading, for example:

    上传小型架构

  2. 准备就绪后,选择“确定” 。When you're ready, choose OK.

    完成架构上传后,该架构将显示在“架构”列表中。 After your schema finishes uploading, the schema appears in the Schemas list.

添加 2 MB 以上的架构Add schemas more than 2 MB

若要添加更大的架构,可将架构上传到 Azure 存储帐户中的 Azure Blob 容器。To add larger schemas, you can upload your schema to an Azure blob container in your Azure storage account. 添加架构的步骤因 Blob 容器是否具有公共读取访问权限而异。Your steps for adding schemas differ based whether your blob container has public read access. 因此,首先请执行以下步骤检查 Blob 容器是否具有公共读取访问权限:为 Blob 容器设置公共访问级别So first, check whether or not your blob container has public read access by following these steps: Set public access level for blob container

检查容器访问级别Check container access level

  1. 打开 Azure 存储资源管理器。Open Azure Storage Explorer. 在“资源管理器”窗口中展开你的 Azure 订阅(如果尚未展开)。In the Explorer window, expand your Azure subscription if not already expanded.

  2. 展开“存储帐户”>“{你的存储帐户}”>“Blob 容器”。 Expand Storage Accounts > {your-storage-account} > Blob Containers. 选择你的 Blob 容器。Select your blob container.

  3. 在 Blob 容器的快捷菜单中,选择“设置公共访问级别”。 From your blob container's shortcut menu, select Set Public Access Level.

上传到具有公共访问权限的容器Upload to containers with public access

  1. 将架构上传到存储帐户。Upload the schema to your storage account. 在右侧窗口中,选择“上传”。 In the right-hand window, choose Upload.

  2. 完成上传后,选择上传的架构。After you finish uploading, select your uploaded schema. 在工具栏中,选择“复制 URL”以复制架构的 URL。 On the toolbar, choose Copy URL so that you copy the schema's URL.

  3. 返回 Azure 门户,其中已打开“添加架构”窗格。 Return to the Azure portal where the Add Schema pane is open. 输入程序集的名称。Enter a name for your assembly. 选择“大文件(大于 2 MB)”。 Choose Large file (larger than 2 MB).

    此时会显示“内容 URI”框而不是“架构”框。 The Content URI box now appears, rather than the Schema box.

  4. 在“内容 URI”框中,粘贴架构的 URL。 In the Content URI box, paste your schema's URL. 完成添加架构。Finish adding your schema.

完成架构上传后,该架构将显示在“架构”列表中。 After your schema finishes uploading, the schema appears in the Schemas list. 在集成帐户的“概述”页上的“组件”下,“架构”磁贴现在会显示已上传的架构数目。 On your integration account's Overview page, under Components, the Schemas tile now shows the number of uploaded schemas.

上传到没有公共访问权限的容器Upload to containers without public access

  1. 将架构上传到存储帐户。Upload the schema to your storage account. 在右侧窗口中,选择“上传”。 In the right-hand window, choose Upload.

  2. 上传完成后,为架构生成共享访问签名 (SAS)。After you finish uploading, generate a shared access signature (SAS) for your schema. 在架构的快捷菜单中,选择“获取共享访问签名”。 From your schema's shortcut menu, select Get Shared Access Signature.

  3. 在“共享访问签名”窗格中,选择“生成容器级共享访问签名 URI” > “创建”。 In the Shared Access Signature pane, select Generate container-level shared access signature URI > Create. 生成 SAS URL 后,选择“URL”框旁边的“复制”。 After the SAS URL gets generated, next to the URL box, choose Copy.

  4. 返回 Azure 门户,其中已打开“添加架构”窗格。 Return to the Azure portal where the Add Schema pane is open. 选择“大文件”。 Choose Large file.

    此时会显示“内容 URI”框而不是“架构”框。 The Content URI box now appears, rather than the Schema box.

  5. 在“内容 URI”框中,粘贴前面生成的 SAS URI。 In the Content URI box, paste the SAS URI you previously generated. 完成添加架构。Finish adding your schema.

完成架构上传后,该架构将显示在“架构”列表中。 After your schema finishes uploading, the schema appears in the Schemas list. 在集成帐户的“概述”页上的“组件”下,“架构”磁贴现在会显示已上传的架构数目。 On your integration account's Overview page, under Components, the Schemas tile now shows the number of uploaded schemas.

编辑架构Edit schemas

若要更新现有的架构,必须上传一个新的架构文件,其中包含所要做出的更改。To update an existing schema, you have to upload a new schema file that has the changes you want. 但是,可以先下载现有的架构进行编辑。However, you can first download the existing schema for editing.

  1. Azure 门户中,找到并打开你的集成帐户(如果尚未打开)。In the Azure portal, find and open your integration account, if not already open.

  2. 在 Azure 主菜单中,选择“所有服务” 。On the main Azure menu, select All services. 在搜索框中,输入“集成帐户”。In the search box, enter "integration account". 选择“集成帐户”。 Select Integration accounts.

  3. 选择要在其中更新架构的集成帐户。Select the integration account where you want to update your schema.

  4. 在集成帐户的“概述”页上的“组件”下,选择“架构”磁贴。 On your integration account's Overview page, under Components, select the Schemas tile.

  5. “架构”页打开后,请选择你的架构。 After the Schemas page opens, select your schema. 若要先下载并编辑架构,请选择“下载”,然后保存架构。 To download and edit the schema first, choose Download, and save the schema.

  6. 准备好上传更新的架构时,请在“架构”页上选择要更新的架构,然后选择“更新”。 When you're ready to upload the updated schema, on the Schemas page, select the schema you want to update, and choose Update.

  7. 找到并选择要上传的已更新架构。Find and select the updated schema you want to upload. 完成架构文件的上传后,更新的架构将显示在“架构”列表中。 After your schema file finishes uploading, the updated schema appears in the Schemas list.

删除架构Delete schemas

  1. Azure 门户中,找到并打开你的集成帐户(如果尚未打开)。In the Azure portal, find and open your integration account, if not already open.

  2. 在 Azure 主菜单中,选择“所有服务” 。On the main Azure menu, select All services. 在搜索框中,输入“集成帐户”。In the search box, enter "integration account". 选择“集成帐户”。 Select Integration accounts.

  3. 选择要在其中删除架构的集成帐户。Select the integration account where you want to delete your schema.

  4. 在集成帐户的“概述”页上的“组件”下,选择“架构”磁贴。 On your integration account's Overview page, under Components, select the Schemas tile.

  5. “架构”页打开后,请选择你的架构,然后选择“删除”。 After the Schemas page opens, select your schema, and choose Delete.

  6. 若要确认删除该架构,请选择“是” 。To confirm that you want to delete the schema, choose Yes.

后续步骤Next steps