Azure API 管理:WADL 文档不包含'resources'元素



我正在尝试使用 Azure API 管理服务创建 API。为此,我有一个部署到Azure Web服务器并返回XML响应的服务,如下所示:XML 响应

我正在尝试在 Azure API 管理服务实例上集成此终结点,但收到如下所示的错误: 添加终结点时出错

对此相当陌生,需要有关问题原因以及我错过的其他事情的帮助。另外,在创建 API 时我们可以为 API 字段提供什么样的端点

导入 API

时,您需要提供可以返回 API 规范的 URL(而不是 API 的 URL(。当您选择 WADL 格式时,请提供一个 URL,该 URL 可以按以下格式返回您的 API 规范。

<resources base="http://xx.domain.com/api/">
  <resource path="newsSearch">
    <method name="GET" id="search">
      <request>
        <param name="p1" style="query" type="xsd:int" default="1"/>
        <param name="p2" style="query" type="xsd:string" default="abc"/>
      </request>
      <response status="200">
        <representation mediaType="application/xml" element="yn:ResultSet"/>
      </response>
      <response status="400">
        <representation mediaType="application/xml" element="ya:Error"/>
      </response>
    </method>
  </resource>
</resources>

如果您的 API 是由 ASP.NET Web API 创建的,则可以使用 Swashbuckle 生成大摇大摆的格式规范。然后,您可以通过选择 Swagger 格式来导入您的 API 规范。

最新更新