Metadata-Version: 2.1
Name: fastapi-soap
Version: 0.0.2
Summary: 
Author: Cleiton Junior Mittmann
Author-email: mittmannv8@gmail.com
Requires-Python: >=3.10,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Framework :: FastAPI
Classifier: Framework :: Pydantic
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.10
Classifier: Topic :: Internet
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: fastapi (>=0.95.0,<0.96.0)
Requires-Dist: lxml (>=4.9.2,<5.0.0)
Requires-Dist: pydantic (>=1.10.5,<2.0.0)
Requires-Dist: pydantic-xml[lxml] (>=0.6.0,<0.7.0)
Project-URL: Bug Tracker, https://github.com/mittmannv8/fastapi-soap/issues
Project-URL: Documentation, https://github.com/mittmannv8/fastapi-soap
Project-URL: Homepage, https://github.com/mittmannv8/fastapi-soap
Description-Content-Type: text/markdown

# 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

```python
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/
```


