在带有 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
Azure 订阅。An Azure subscription. 如果没有订阅,可以注册 Azure 试用帐户。If you don't have a subscription, sign up for a trial Azure account.
一个集成帐户,用于存储架构以及企业集成与企业到企业 (B2B) 解决方案的其他项目。An integration account where you store your schemas and other artifacts for enterprise integration and business-to-business (B2B) solutions.
如果架构为 2 MB 或更小,可以直接从 Azure 门户将架构添加到集成帐户。If your schema is 2 MB or smaller, you can add your schema to your integration account directly from the Azure portal. 但是,如果架构大于 2 MB 但不超过架构大小限制,则你可以将架构上传到 Azure 存储帐户。However, if your schema is bigger than 2 MB but no bigger than the schema size limit, you can upload your schema to an Azure storage account. 若要将该架构添加到集成帐户,可以从集成帐户链接到存储帐户。To add that schema to your integration account, you can then link to your storage account from your integration account. 若要完成此任务,需要提供以下各项:For this task, here are the items you need:
Azure 存储帐户,将在其中为架构创建 Blob 容器。Azure storage account where you create a blob container for your schema. 了解如何创建存储帐户。Learn how to create a storage account.
用于存储架构的 Blob 容器。Blob container for storing your schema. 了解如何创建 Blob 容器。Learn how to create a blob container. 稍后将架构添加到集成帐户时,需要容器的内容 URI。You need your container's content URI later when you add the schema to your integration account.
Azure 存储资源管理器,可用于管理存储帐户和 Blob 容器。Azure Storage Explorer, which you can use for managing storage accounts and blob containers. 若要使用存储资源管理器,请选择以下任一选项:To use Storage Explorer, choose either option here:
在 Azure 门户中找到并选择你的存储帐户。In the Azure portal, find and select your storage account. 在存储帐户菜单中选择“存储资源管理器”。 From your storage account menu, select Storage Explorer.
对于桌面版本,请下载并安装 Azure 存储资源管理器。For the desktop version, download and install Azure Storage Explorer. 然后,遵循存储资源管理器入门中的步骤将存储资源管理器连接到存储帐户。Then, connect Storage Explorer to your storage account by following the steps in Get started with Storage Explorer. 若要了解详细信息,请参阅快速入门:使用 Azure 存储资源管理器在对象存储中创建 Blob。To learn more, see Quickstart: Create a blob in object storage with Azure Storage Explorer.
创建和添加架构时不需要逻辑应用。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
使用 Azure 帐户凭据登录到 Azure 门户。Sign in to the Azure portal with your Azure account credentials.
若要查找并打开集成帐户,请在 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.
选择要将架构添加到的集成帐户,例如:Select the integration account where you want to add your schema, for example:
在集成帐户的“概述”页上的“组件”下,选择“架构”磁贴。 On your integration account's Overview page, under Components, select the Schemas tile.
“架构”页打开后,请选择“添加”。 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
在“添加架构”下,输入架构的名称。 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:
准备就绪后,选择“确定” 。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
打开 Azure 存储资源管理器。Open Azure Storage Explorer. 在“资源管理器”窗口中展开你的 Azure 订阅(如果尚未展开)。In the Explorer window, expand your Azure subscription if not already expanded.
展开“存储帐户”>“{你的存储帐户}”>“Blob 容器”。 Expand Storage Accounts > {your-storage-account} > Blob Containers. 选择你的 Blob 容器。Select your blob container.
在 Blob 容器的快捷菜单中,选择“设置公共访问级别”。 From your blob container's shortcut menu, select Set Public Access Level.
如果 Blob 容器至少具有公共访问权限,请选择“取消”,并执行本页稍后所述的以下步骤: 上传到具有公共访问权限的容器If your blob container has at least public access, choose Cancel, and follow these steps later on this page: Upload to containers with public access
如果 Blob 容器没有公共访问权限,请选择“取消”,并执行本页稍后所述的以下步骤: 上传到没有公共访问权限的容器If your blob container doesn't have public access, choose Cancel, and follow these steps later on this page: Upload to containers without public access
上传到具有公共访问权限的容器Upload to containers with public access
将架构上传到存储帐户。Upload the schema to your storage account. 在右侧窗口中,选择“上传”。 In the right-hand window, choose Upload.
完成上传后,选择上传的架构。After you finish uploading, select your uploaded schema. 在工具栏中,选择“复制 URL”以复制架构的 URL。 On the toolbar, choose Copy URL so that you copy the schema's URL.
返回 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.
在“内容 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
将架构上传到存储帐户。Upload the schema to your storage account. 在右侧窗口中,选择“上传”。 In the right-hand window, choose Upload.
上传完成后,为架构生成共享访问签名 (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.
在“共享访问签名”窗格中,选择“生成容器级共享访问签名 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.
返回 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.
在“内容 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.
在 Azure 门户中,找到并打开你的集成帐户(如果尚未打开)。In the Azure portal, find and open your integration account, if not already open.
在 Azure 主菜单中,选择“所有服务” 。On the main Azure menu, select All services. 在搜索框中,输入“集成帐户”。In the search box, enter "integration account". 选择“集成帐户”。 Select Integration accounts.
选择要在其中更新架构的集成帐户。Select the integration account where you want to update your schema.
在集成帐户的“概述”页上的“组件”下,选择“架构”磁贴。 On your integration account's Overview page, under Components, select the Schemas tile.
“架构”页打开后,请选择你的架构。 After the Schemas page opens, select your schema. 若要先下载并编辑架构,请选择“下载”,然后保存架构。 To download and edit the schema first, choose Download, and save the schema.
准备好上传更新的架构时,请在“架构”页上选择要更新的架构,然后选择“更新”。 When you're ready to upload the updated schema, on the Schemas page, select the schema you want to update, and choose Update.
找到并选择要上传的已更新架构。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
在 Azure 门户中,找到并打开你的集成帐户(如果尚未打开)。In the Azure portal, find and open your integration account, if not already open.
在 Azure 主菜单中,选择“所有服务” 。On the main Azure menu, select All services. 在搜索框中,输入“集成帐户”。In the search box, enter "integration account". 选择“集成帐户”。 Select Integration accounts.
选择要在其中删除架构的集成帐户。Select the integration account where you want to delete your schema.
在集成帐户的“概述”页上的“组件”下,选择“架构”磁贴。 On your integration account's Overview page, under Components, select the Schemas tile.
“架构”页打开后,请选择你的架构,然后选择“删除”。 After the Schemas page opens, select your schema, and choose Delete.
若要确认删除该架构,请选择“是” 。To confirm that you want to delete the schema, choose Yes.