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 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 Distribution
fastapi-soap-0.0.1.tar.gz
(7.6 kB
view details)
Built Distribution
File details
Details for the file fastapi-soap-0.0.1.tar.gz
.
File metadata
- Download URL: fastapi-soap-0.0.1.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- 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 | ad35e011eb472f5a84e58dd072d2698c24a5baa140cc8dedda0ba24e431129a1 |
|
MD5 | 995376b57b888408fdd852bd66cd936f |
|
BLAKE2b-256 | eca03f23dea1b98d1bd66cd91bc94ced9458a67ed2b536dd5c649e3593caeb03 |
File details
Details for the file fastapi_soap-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: fastapi_soap-0.0.1-py3-none-any.whl
- Upload date:
- Size: 8.6 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 | 0c65bf4eee2d9c1adb3baaed47dcb8d1ba90af3b791bfeecdd0fca54adb32cc0 |
|
MD5 | dadd5a7d6380d20f3ce09f9391ce62f7 |
|
BLAKE2b-256 | f223feebdd3d1665a0a982cf21d6d9ce734f0ae96c960bf89ea52d8b9de826e6 |