OpenAPI 3 显示 SOAP Web 服务

问题描述 投票:0回答:1

我目前正在编写 OpenAPI,以将 SOAP API 作为 REST API 显示到 swagger 上。

我目前正在使用公共 SOAP Web 服务并尝试使用 Java 应用程序转换为 OpenAPI 格式。这是公共 SOAP Web 服务站点 -> https://www.dataaccess.com/webservicesserver/NumberConversion.wso

我想知道是否可以指示请求 URL(在照片上以紫色突出显示)而不附加 REST API(在照片上以红色突出显示)。

附上OpenAPI

openapi: 3.0.1
info:
  title: SOAP API to REST API
  version: 3.0.3
servers:
- url: https://www.dataaccess.com/webservicesserver/NumberConversion.wso
paths:
  /NumberToWords:
    post:
      operationId: NumberToWords
      requestBody:
        content:
          text/xml:
            schema:
              $ref: '#/components/schemas/rootElement_NumberToWords'
        required: true
      responses:
        default:
          description: Default Description
          content:
            text/xml charset=UTF-8:
              schema:
                $ref: '#/components/schemas/rootElement_NumberToWordsResponse'
      x-wso2-soap:
        x-soap-style: document
        soap-action: ""
        x-soap-message-type: document
        soap-operation: NumberToWords
        namespace: http://www.dataaccess.com/webservicesserver/
        x-soap-version: "1.2"
  /NumberToDollars:
    post:
      operationId: NumberToDollars
      requestBody:
        content:
          text/xml:
            schema:
              $ref: '#/components/schemas/rootElement_NumberToDollars'
        required: true
      responses:
        default:
          description: Default Description
          content:
            text/xml charset=UTF-8:
              schema:
                $ref: '#/components/schemas/rootElement_NumberToDollarsResponse'
      x-wso2-soap:
        x-soap-style: document
        soap-action: ""
        x-soap-message-type: document
        soap-operation: NumberToDollars
        namespace: http://www.dataaccess.com/webservicesserver/
        x-soap-version: "1.2"
components:
  schemas:
    NumberToWordsResult:
      type: string
      xml: {}
    rootElement_NumberToWordsResponse:
      type: object
      properties:
        Body:
          type: object
          properties:
            NumberToWordsResponse:
              type: object
              properties:
                NumberToWordsResult:
                  type: string
                  xml: {}
              xml:
                namespace: http://www.dataaccess.com/webservicesserver/
          xml:
            prefix: soap
      xml:
        name: Envelope
        namespace: http://schemas.xmlsoap.org/soap/envelope/
        prefix: soap
    dNum:
      type: integer
      xml: {}
    rootElement_NumberToDollars:
      type: object
      properties:
        Body:
          type: object
          properties:
            NumberToDollars:
              type: object
              properties:
                dNum:
                  type: integer
                  xml: {}
              xml:
                namespace: http://www.dataaccess.com/webservicesserver/
          xml:
            prefix: soap
      xml:
        name: Envelope
        namespace: http://schemas.xmlsoap.org/soap/envelope/
        prefix: soap
    ubiNum:
      type: integer
      xml: {}
    rootElement_NumberToWords:
      type: object
      properties:
        Body:
          type: object
          properties:
            NumberToWords:
              type: object
              properties:
                ubiNum:
                  type: integer
                  xml: {}
              xml:
                namespace: http://www.dataaccess.com/webservicesserver/
          xml:
            prefix: soap
      xml:
        name: Envelope
        namespace: http://schemas.xmlsoap.org/soap/envelope/
        prefix: soap
    NumberToDollarsResult:
      type: string
      xml: {}
    rootElement_NumberToDollarsResponse:
      type: object
      properties:
        Body:
          type: object
          properties:
            NumberToDollarsResponse:
              type: object
              properties:
                NumberToDollarsResult:
                  type: string
                  xml: {}
              xml:
                namespace: http://www.dataaccess.com/webservicesserver/
          xml:
            prefix: soap
      xml:
        name: Envelope
        namespace: http://schemas.xmlsoap.org/soap/envelope/
        prefix: soap
soap swagger openapi soap-client swagger-2.0
1个回答
0
投票

OpenAPI 是一种描述格式,通过 URL 和 HTTP 动词来标识操作。因此,使用 OpenAPI 描述 SOAP 服务非常困难,因为 SOAP 使用单个 URL,并且不同的操作由请求体的内容来标识。我没有任何建议给你,只是要认识到这很困难,因为这两个工具对 API 的看法截然不同。

如果您需要 SOAP 服务的文档,最好寻找 SOAP 特定的工具(未来用户请注意:这个答案可能会因 OpenAPI 4.0 而失效,但仍处于早期阶段)。很抱歉这不是您想要的答案!

© www.soinside.com 2019 - 2024. All rights reserved.