No project description provided
Project description
FastAPI Soap
This package helps to create Soap WebServices using FastAPI (What?!?!)
Motivation
I know, FastAPI is a REST micro framework, but sometimes is needed to expose a Soap Interface on a already running FastAPI application for an legacy client/application that only supports, well, the Soap protocol...
Installation and dependencies
Only FastAPI, Pydantic and Pydantic XML are required.
First steps
from fastapi import FastAPI
from fastapi_soap.models import BodyContent
class Operands(BodyContent, tag="Operands"):
operands: list[float] = element(tag="Operand")
class Result(BodyContent, tag="Result"):
value: float
soap = SoapRouter(name='Calculator', prefix='/Calculator')
@soap.operation(
name="SumOperation",
request_model=Operands,
response_model=Result
)
def sum_operation(body: Operands = XMLBody(Operands)):
result = sum(body.operands)
return SoapResponse(
Result(value=result)
)
app = FastAPI()
app.include_router(soap)
if __name__ == '__main__':
import uvicorn
uvicorn.run("example.main:app")
(This script is complete, it should run "as is")
The WSDL is available on webservice root path for GET method.
GET http://localhost:8000/Calculator/
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file fastapi_soap-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: fastapi_soap-0.0.3-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.0 CPython/3.10.6 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b7f76de2a40c58c7c62deb7a5aa39d66f909c983b146232a4d61c438c37c798 |
|
MD5 | 0225ae5a80f19ac834952bc0dd88f5ef |
|
BLAKE2b-256 | 68a67f20537f28c5215d07e483bbbcf37b0e2b05253f84620ac174dc2a9871da |