Suds-py3
Suds-py3 is a lightweight Python SOAP client that provides a service proxy for Web Services, originally forked from the unmaintained Python 2 `suds` library to support Python 3. It allows users to interact with SOAP-based web services without deep concerns about WSDL complexities, presenting an RPC-like interface. The current version is 1.4.5.0, with releases focused on bug fixes and Python 3 compatibility, though its maintenance status has been flagged as low by OpenSSF scorecard.
Warnings
- breaking The original `suds` library (Python 2) is unmaintained, and its documentation has disappeared. `suds-py3` is a separate fork for Python 3 compatibility and ongoing fixes. Ensure you are installing `suds-py3` for Python 3 projects to avoid compatibility issues and use the maintained version.
- breaking Older versions of `suds` and `suds-py3` (specifically `suds` <= 0.4 and `suds-py3` < 1.4.4.1) were vulnerable to CVE-2013-2217, an improper link resolution before file access, allowing local users to redirect SOAP queries via a symlink attack on temporary cache files.
- gotcha Handling Unicode characters with web services, especially when interfacing with older or poorly configured SOAP services, can lead to `UnicodeDecodeError` or `UnicodeEncodeError`. While `suds-py3` aims to be Python 3 compatible, explicit encoding/decoding may still be necessary at the application level.
- gotcha SOAP WSDLs and schemas are often malformed or contain incorrect import rules, leading to `suds` failing to parse the service definition correctly. `suds` provides 'doctors' to mend broken schemas at runtime.
- gotcha Debugging SOAP interactions can be challenging. `suds-py3` relies on Python's standard `logging` module, and by default, detailed SOAP messages (sent/received) are not shown.
- gotcha When working with complex types defined in the WSDL, merely passing Python dictionaries may not always work as expected for creating input objects. `suds-py3` provides a factory to explicitly create these types.
- gotcha The OpenSSF Scorecard indicates that `suds-py3` has low activity in terms of commits and issue resolution (0 commits/issues in the last 90 days as of March 2, 2026). This suggests that active development might be slow.
Install
-
pip install suds-py3
Imports
- Client
from suds.client import Client
Quickstart
import os
from suds.client import Client
# Replace with your WSDL URL. Use a placeholder for demonstration.
# A public WSDL for testing temperature conversion:
# wsdl_url = "http://www.w3schools.com/xml/tempconvert.asmx?WSDL"
wsdl_url = os.environ.get('SOAP_WSDL_URL', 'http://www.w3schools.com/xml/tempconvert.asmx?WSDL')
try:
# Initialize the SOAP client
client = Client(wsdl_url)
print(f"Connected to SOAP service at: {wsdl_url}")
# Optionally, print available services and methods
# print(client)
# print("Available services:", client.service)
# print("Available factory types:", client.factory)
# Example: Call a method (assuming TemperatureConvert service)
# If the WSDL had authentication, you'd pass username/password to Client constructor
# client = Client(wsdl_url, username=os.environ.get('SOAP_USERNAME', ''), password=os.environ.get('SOAP_PASSWORD', ''))
# Convert Fahrenheit to Celsius
fahrenheit_temp = 32.0
celsius_temp = client.service.FahrenheitToCelsius(fahrenheit_temp)
print(f"{fahrenheit_temp}°F is {celsius_temp}°C")
# Convert Celsius to Fahrenheit
celsius_temp_input = 0.0
fahrenheit_temp_output = client.service.CelsiusToFahrenheit(celsius_temp_input)
print(f"{celsius_temp_input}°C is {fahrenheit_temp_output}°F")
except Exception as e:
print(f"An error occurred: {e}")
print("Please ensure the WSDL URL is correct and the service is accessible.")
print("For debugging, you can enable logging: import logging; logging.getLogger('suds.client').setLevel(logging.DEBUG)")