导入 SOAP APIImport SOAP API

本文介绍如何导入 SOAP API 的标准 XML 表示形式。This article shows how to import a standard XML representation of a SOAP API. 本文还介绍如何测试 API 管理 API。The article also shows how to test the API Management API.

在本文中,学习如何:In this article, you learn how to:

  • 导入 SOAP APIImport SOAP API
  • 在 Azure 门户中测试 APITest the API in the Azure portal
  • 在开发人员门户中测试 APITest the API in the Developer portal

先决条件Prerequisites

完成以下快速入门:创建一个 Azure API 管理实例Complete the following quickstart: Create an Azure API Management instance

转到你的 API 管理实例Go to your API Management instance

  1. 登录到 Azure 门户Sign in to the Azure portal.

  2. 选择“所有服务”。Select All services.

  3. 在搜索框中输入 apiIn the search box, enter api.

  4. 在搜索结果中,选择“API 管理服务”。In the search results, select API Management services.

  5. 选择自己的 API 管理服务实例。Select your API Management service instance.

提示

若要将 API 管理添加到 Azure 门户中的收藏夹,请选择星形。To add API Management to your favorites in the Azure portal, select the star.

API 管理图标The API Management icon ((API 管理图标)现在显示在门户的左侧菜单中。) now appears in the left menu in the portal.

导入和发布后端 API Import and publish a back-end API

  1. 在 Azure 门户中导航到 API 管理服务,然后从菜单中选择“API”。Navigate to your API Management service in the Azure portal and select APIs from the menu.

  2. 从“添加新的 API”列表中选择“WSDL” 。Select WSDL from the Add a new API list.

    Soap api

  3. 在“WSDL 规范”,输入要将 SOAP API 放到的 URL。In the WSDL specification, enter the URL to where your SOAP API resides.

  4. “SOAP 直通”选按钮默认处于选中状态。The SOAP pass-through radio button is selected by default. 进行此选择,API 将作为 SOAP 公开。With this selection, the API is going to be exposed as SOAP. 使用者必须使用 SOAP 规则。Consumer has to use SOAP rules. 若要“REST 化”API,请按照导入 SOAP API 并将其转换为 REST 中的步骤进行操作。If you want to "restify" the API, follow the steps in Import a SOAP API and convert it to REST.

    直通

  5. 按 Tab 键。Press tab.

    以下字段中填充了来自 SOAP API 的信息:显示名称、名称、说明。The following fields get filled up with the info from the SOAP API: Display name, Name, Description.

  6. 添加 API URL 后缀。Add an API URL suffix. 后缀是用于在该 API 管理实例中标识此特定 API 的名称。The suffix is a name that identifies this specific API in this API Management instance. 在该 API 管理实例中,后缀必须唯一。It has to be unique in this API Management instance.

  7. 通过关联 API 与产品来发布 API。Publish the API by associating the API with a product. 本例中使用了“无限制”产品。In this case, the "Unlimited" product is used. 如果想要发布 API 并使其对开发人员可用,请将其添加到产品中。If you want for the API to be published and be available to developers, add it to a product. 可在 API 创建期间执行此操作,或稍后进行设置。You can do it during API creation or set it later.

    产品是一个或多个 API 的关联。Products are associations of one or more APIs. 可以包含多个 API,并通过开发人员门户将其提供给开发人员。You can include a number of APIs and offer them to developers through the developer portal. 开发人员必须先订阅产品才能访问 API。Developers must first subscribe to a product to get access to the API. 订阅时,他们会得到一个订阅密钥,此密钥对该产品中的任何 API 都有效。When they subscribe, they get a subscription key that is good for any API in that product. 如果你创建了 API 管理实例,那么你已是管理员,因此默认情况下订阅了每个产品。If you created the API Management instance, you are an administrator already, so you are subscribed to every product by default.

    默认情况下,每个 API 管理实例附带两个示例产品:By default, each API Management instance comes with two sample products:

    • 初学者Starter
    • 无限制Unlimited
  8. 输入其他 API 设置。Enter other API settings. 可以在创建过程中设置这些值,也可以稍后转到“设置”选项卡来配置这些值。在导入和发布第一个 API 教程中对这些设置进行了说明。You can set the values during creation or configure them later by going to the Settings tab. The settings are explained in the Import and publish your first API tutorial.

  9. 选择“创建” 。Select Create.

在管理门户中测试新的 APITest the new API in the administrative portal

可直接从管理门户调用操作,这样可以方便地查看和测试 API 的操作。Operations can be called directly from the administrative portal, which provides a convenient way to view and test the operations of an API.

  1. 选择上一步中创建的 API。Select the API you created in the previous step.

  2. 按“测试”选项卡。Press the Test tab.

  3. 选择某个操作。Select some operation.

    该页将显示查询参数的字段和标头的字段。The page displays fields for query parameters and fields for the headers. 其中一个标头是“Ocp-Apim-Subscription-Key”,用于提供和此 API 关联的产品订阅密钥。One of the headers is "Ocp-Apim-Subscription-Key", for the subscription key of the product that is associated with this API. 如果创建了 API 管理实例,那么你已是管理员,因此会自动填充该密钥。If you created the API Management instance, you are an administrator already, so the key is filled in automatically.

  4. 按“发送”。Press Send.

    后端以“200 正常”和某些数据做出响应。Backend responds with 200 OK and some data.

追加其他 APIAppend other APIs

API 可以包含由其他服务公开的 API,这些服务包括 OpenAPI 规范、SOAP API、Azure 应用服务的 API 应用功能、Azure Function App、Azure 逻辑应用和 Azure Service Fabric。An API can be composed of APIs exposed by different services, including the OpenAPI Specification, a SOAP API, the API Apps feature of Azure App Service, Azure Function App, Azure Logic Apps, and Azure Service Fabric.

导入 API

若要将其他 API 追加到现有 API,请完成以下步骤。To append a different API to your existing API, complete the following steps. 导入另一个 API 时,操作将追加到当前 API 后面。When you import another API, the operations are appended to your current API.

  1. 在 Azure 门户中转到自己的 Azure API 管理实例。Go to your Azure API Management instance in the Azure portal.
  2. 在左侧菜单中选择“API”。Select APIs from the menu on the left.
  3. 单击要将另一个 API 追加到的 API 旁边的“...”。Click ... next to the API that you want to append another API to.
  4. 从下拉菜单中选择“导入”。Select Import from the drop-down menu.
  5. 选择要从中导入 API 的服务。Select a service from which to import an API.

后续步骤Next steps