soap2rest
Convert any SOAP WSDL service to a REST API using FastAPI.
Features
- 🔄 Automatic Conversion: Automatically converts SOAP operations to REST endpoints
- 🚀 FastAPI Powered: Built on FastAPI for high performance and automatic API documentation
- 🔧 Zero Configuration: No manual endpoint configuration needed
- 📚 Interactive Docs: Automatic Swagger/OpenAPI documentation at
/docs - 🛡️ Error Handling: Proper HTTP status codes for SOAP faults, timeouts, and connection errors
- ⚡ Async Support: Non-blocking SOAP calls using thread pool execution
Installation
From Source
git clone https://github.com/yourusername/soap2rest.git
cd soap2rest
pip install .
From PyPI (when published)
pip install soap2rest
Quick Start
- Start the server with a WSDL URL:
soap2rest --wsdl https://www.dataaccess.com/webservicesserver/NumberConversion.wso?WSDL --port 8000
- View the API documentation:
Open http://localhost:8000/docs in your browser to see the interactive Swagger UI.
- Call the REST API:
curl -X POST http://localhost:8000/call/NumberToWords \
-H "Content-Type: application/json" \
-d '{"ubiNum": "123"}'
Usage
Basic Usage
soap2rest --wsdl <WSDL_URL> --port 8000
Advanced Options
soap2rest \
--wsdl https://example.com/service.wsdl \
--host 0.0.0.0 \
--port 8000 \
--workers 4 \
--log-level info \
--reload
Environment Variables
You can also configure the server using environment variables:
export SOAP2REST_WSDL="https://example.com/service.wsdl"
export SOAP2REST_PORT=8000
export SOAP2REST_HOST="0.0.0.0"
export SOAP2REST_WORKERS=4
export SOAP2REST_LOG_LEVEL="info"
export SOAP2REST_RELOAD="true"
soap2rest
Command Line Options
--wsdl(required): WSDL URL or file path--host(default:0.0.0.0): Host to bind to--port(default:8000): Port to bind to--workers(default:1): Number of worker processes--log-level(default:info): Logging level (critical, error, warning, info, debug, trace)--reload(default:false): Enable auto-reload for development--timeout-keep-alive(default:5): Keep-alive timeout in seconds
How It Works
- WSDL Parsing: The tool loads and parses the WSDL file/URL
- Operation Discovery: Automatically discovers all SOAP operations
- REST Endpoint Generation: Creates REST endpoints for each SOAP operation
- Dynamic Model Creation: Generates Pydantic models for request validation
- Request Processing: Converts REST requests to SOAP calls and returns JSON responses
Example
Given a SOAP service with operation NumberToWords, the tool automatically creates:
GET /- Lists all available operationsPOST /call/NumberToWords- REST endpoint for the SOAP operation
Request:
POST /call/NumberToWords
{
"ubiNum": "123"
}
Response:
{
"result": "one hundred and twenty three "
}
Development
Setting Up Development Environment
git clone https://github.com/yourusername/soap2rest.git
cd soap2rest
pip install -e ".[dev]"
Running Tests
pytest
Building the Package
python -m build
Publishing to PyPI
python -m build
python -m twine upload dist/*
Requirements
- Python 3.8+
- FastAPI
- Uvicorn
- Zeep (SOAP client)
- Pydantic
- AnyIO
License
MIT License - see LICENSE file for details
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
For issues and questions, please open an issue on GitHub.
Release files for soap2rest 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| soap2rest-0.1.0.tar.gz | 7.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| soap2rest-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.7 kB
Release files / soap2rest-0.1.0.tar.gz
| Download URL | soap2rest-0.1.0.tar.gz |
|---|---|
| Size | 7.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dda76e2102fa2256c66aea368854a17f5cf9e807c7a2b489dce59749da80d68a
|
|
BLAKE2b-256 checksum How to use checksums |
1d81674f9deecc7f4b175db3416417c437013a534e67d781d5239f3e67f7fecb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / soap2rest-0.1.0-py3-none-any.whl
| Download URL | soap2rest-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cfa25a438ba1a637de53b2c4f6051315410274b3d46692630ede2f0dc72d4c5e
|
|
BLAKE2b-256 checksum How to use checksums |
4de749f1609cf7b086eac80cf349a1874fc889f9bc7632c5e8a7f28b4ec8f28f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|