or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

client-operations.mdexception-handling.mdindex.mdplugin-system.mdtransport-settings.mdwsse-security.mdxsd-types.md
tile.json

tessl/pypi-zeep

A comprehensive Python SOAP client library for consuming SOAP web services with support for SOAP 1.1/1.2, WSSE authentication, and async operations

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/zeep@4.3.x

To install, run

npx @tessl/cli install tessl/pypi-zeep@4.3.0

index.mddocs/

Zeep

A comprehensive Python SOAP client library for consuming SOAP web services with support for SOAP 1.1/1.2, WSSE authentication, and async operations. Zeep provides a modern, Pythonic interface for working with SOAP services, automatic WSDL parsing, type conversion, fault handling, and comprehensive error reporting.

Package Information

  • Package Name: zeep
  • Language: Python
  • Installation: pip install zeep
  • Requirements: Python 3.8+
  • Optional Dependencies:
    • pip install zeep[async] for async support
    • pip install zeep[xmlsec] for XML security

Core Imports

import zeep
from zeep import Client, AsyncClient, Settings, Transport

For advanced features:

from zeep import Plugin, CachingClient
from zeep.wsse import UsernameToken, Signature
from zeep.xsd import AnyObject
from zeep.cache import InMemoryCache, SqliteCache
from zeep.helpers import serialize_object

Basic Usage

from zeep import Client

# Create a SOAP client
client = Client('http://example.com/service.wsdl')

# Call a SOAP operation
result = client.service.SomeOperation(param1='value1', param2='value2')

# Work with the result
print(result)

# Access different services/ports if needed
specific_service = client.bind('ServiceName', 'PortName')
result = specific_service.SomeOperation(param='value')

Architecture

Zeep is built around several core components:

  • Client: Main entry point for SOAP operations (sync/async variants)
  • Transport: HTTP communication layer with caching and session management
  • WSDL: Document parser and operation discovery
  • XSD: XML Schema processing and type conversion
  • WSSE: Web Services Security for authentication and signing
  • Plugin System: Extensible request/response interception

The library automatically handles WSDL parsing, namespace management, type conversion between Python objects and XML, and provides comprehensive error reporting for debugging SOAP interactions.

Capabilities

Client Operations

Core SOAP client functionality for connecting to web services, calling operations, and handling responses. Includes both synchronous and asynchronous clients with automatic WSDL parsing and type conversion.

class Client:
    def __init__(
        self, 
        wsdl: str, 
        wsse=None, 
        transport=None, 
        service_name=None, 
        port_name=None, 
        plugins=None, 
        settings=None
    ): ...
    
    def bind(self, service_name: str = None, port_name: str = None): ...
    def create_service(self, binding_name: str, address: str): ...
    def create_message(self, service, operation_name: str, *args, **kwargs): ...
    def type_factory(self, namespace: str): ...
    def get_type(self, name: str): ...
    def get_element(self, name: str): ...
    def set_ns_prefix(self, prefix: str, namespace: str): ...
    def set_default_soapheaders(self, headers): ...

class AsyncClient(Client): ...
class CachingClient(Client): ...

Client Operations

Transport and Settings

HTTP transport configuration, caching, session management, and XML parsing settings. Controls how zeep communicates with SOAP services and processes XML documents.

class Transport:
    def __init__(
        self, 
        cache=None, 
        timeout: int = 300, 
        operation_timeout: int = None, 
        session=None
    ): ...

class Settings:
    def __init__(
        self,
        strict: bool = True,
        raw_response: bool = False,
        force_https: bool = True,
        extra_http_headers=None,
        xml_huge_tree: bool = False,
        forbid_dtd: bool = False,
        forbid_entities: bool = True,
        forbid_external: bool = True,
        xsd_ignore_sequence_order: bool = False
    ): ...

Transport and Settings

WSSE Security

Web Services Security features including username tokens, digital signatures, and authentication mechanisms for secure SOAP communication.

class UsernameToken:
    def __init__(self, username: str, password: str, password_digest: bool = False): ...

class Signature:
    def __init__(self, key_file: str, cert_file: str): ...

class BinarySignature(Signature): ...
class MemorySignature(Signature): ...
class Compose: ...

WSSE Security

XSD and Type Handling

XML Schema processing, type conversion, and handling of complex XML structures. Provides tools for working with XSD types and converting between Python objects and XML.

class AnyObject:
    def __init__(self, xsd_object, value): ...

# XSD processing utilities and type conversion
class Schema: ...

# XSD constants
Nil: object
SkipValue: object

# Helper functions
def serialize_object(obj): ...

XSD and Type Handling

Plugin System

Extensible plugin architecture for intercepting and modifying SOAP requests and responses. Enables custom logging, authentication, caching, and other cross-cutting concerns.

class Plugin:
    def ingress(self, envelope, http_headers, operation): ...
    def egress(self, envelope, http_headers, operation, binding_options): ...

class HistoryPlugin(Plugin):
    def __init__(self, maxlen: int = 1): ...

Plugin System

Exception Handling

Comprehensive exception hierarchy for handling SOAP faults, transport errors, XML parsing issues, and validation failures with detailed error information.

class Error(Exception): ...
class Fault(Error): ...
class TransportError(Error): ...
class ValidationError(Error): ...
class XMLSyntaxError(Error): ...
class WsdlSyntaxError(Error): ...

Exception Handling

Types

# Main client types
Client = typing.Type[Client]
AsyncClient = typing.Type[AsyncClient]
CachingClient = typing.Type[CachingClient]

# Configuration types  
Settings = typing.Type[Settings]
Transport = typing.Type[Transport]
AsyncTransport = typing.Type[AsyncTransport]

# Security types
UsernameToken = typing.Type[UsernameToken]
Signature = typing.Type[Signature]

# XSD types
AnyObject = typing.Type[AnyObject]
Schema = typing.Type[Schema]

# Plugin types
Plugin = typing.Type[Plugin]
HistoryPlugin = typing.Type[HistoryPlugin]

# Cache types
InMemoryCache = typing.Type[InMemoryCache]
SqliteCache = typing.Type[SqliteCache]

# Helper functions
def serialize_object(obj): ...