{
  "openapi": "3.1.0",
  "info": {
    "title": "SOAP Web Service API",
    "version": "1.0",
    "description": "Practise SOAP testing in SoapUI, Postman or code: a calculator and a country lookup with WSDLs, SOAP 1.1 (text/xml) and 1.2 (application/soap+xml) envelopes, and real SOAP Faults for divide by zero, unknown operations and malformed input."
  },
  "servers": [
    {
      "url": "https://funapi.dev/api/soap/v1"
    }
  ],
  "tags": [
    {
      "name": "calculator",
      "description": "Add, Subtract, Multiply, Divide"
    },
    {
      "name": "countries",
      "description": "GetCountry"
    }
  ],
  "paths": {
    "/calculator.wsdl": {
      "get": {
        "tags": [
          "calculator"
        ],
        "summary": "WSDL for the calculator service (SOAP 1.1 and 1.2 bindings)",
        "operationId": "sp-calc-wsdl",
        "responses": {
          "200": {
            "description": "WSDL (text/xml)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Global rate limit exceeded (300 requests a minute per IP) — wait for Retry-After",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/calculator": {
      "post": {
        "tags": [
          "calculator"
        ],
        "summary": "Add, Subtract, Multiply, Divide — divide by zero returns a SOAP Fault",
        "operationId": "sp-calc",
        "responses": {
          "200": {
            "description": "SOAP response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "SOAP 1.2 Sender fault",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Global rate limit exceeded (300 requests a minute per IP) — wait for Retry-After",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "SOAP 1.1 fault (all faults are 500 in 1.1)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "SOAPAction",
            "in": "header",
            "required": false,
            "description": "SOAP 1.1 action, e.g. \"https://funapi.dev/soap/calculator/Add\" (accepted, not required)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "text/xml": {
              "schema": {
                "type": "string"
              },
              "example": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:calc=\"https://funapi.dev/soap/calculator\">\n  <soap:Body>\n    <calc:Add>\n      <calc:intA>2</calc:intA>\n      <calc:intB>3</calc:intB>\n    </calc:Add>\n  </soap:Body>\n</soap:Envelope>"
            }
          }
        }
      }
    },
    "/countries.wsdl": {
      "get": {
        "tags": [
          "countries"
        ],
        "summary": "WSDL for the country lookup service",
        "operationId": "sp-country-wsdl",
        "responses": {
          "200": {
            "description": "WSDL (text/xml)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Global rate limit exceeded (300 requests a minute per IP) — wait for Retry-After",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/countries": {
      "post": {
        "tags": [
          "countries"
        ],
        "summary": "GetCountry by ISO 3166 alpha-2 code (SOAP 1.2 example)",
        "operationId": "sp-country",
        "responses": {
          "200": {
            "description": "SOAP response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "SOAP 1.2 Sender fault: unknown code",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Global rate limit exceeded (300 requests a minute per IP) — wait for Retry-After",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "SOAP 1.1 fault",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/soap+xml": {
              "schema": {
                "type": "string"
              },
              "example": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap12:Envelope xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:c=\"https://funapi.dev/soap/countries\">\n  <soap12:Body>\n    <c:GetCountry>\n      <c:isoCode>TR</c:isoCode>\n    </c:GetCountry>\n  </soap12:Body>\n</soap12:Envelope>"
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Use qa-admin-token / qa-viewer-token, or a JWT from POST /auth/v1/login."
      },
      "apiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "Cargo demo key: cargo-key-123."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error",
          "message"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "requestId": {
            "type": "string"
          }
        },
        "additionalProperties": true
      }
    }
  }
}
