Public API


class zeep.Client(wsdl, wsse=None, transport=None, service_name=None, port_name=None, plugins=None, settings=None)

The zeep Client.

  • wsdl – Url/local WSDL location or preparsed WSDL Document
  • wsse
  • transport – Custom transport class.
  • service_name – The service name for the service binding. Defaults to the first service in the WSDL document.
  • port_name – The port name for the default binding. Defaults to the first port defined in the service element in the WSDL document.
  • plugins – a list of Plugin instances
  • settings – a zeep.Settings() object
bind(service_name: Optional[str] = None, port_name: Optional[str] = None)

Create a new ServiceProxy for the given service_name and port_name.

The default ServiceProxy instance (self.service) always referes to the first service/port in the wsdl Document. Use this when a specific port is required.

create_message(service, operation_name, *args, **kwargs)

Create the payload for the given operation.

Return type:lxml.etree._Element
create_service(binding_name, address)

Create a new ServiceProxy for the given binding name and address.

  • binding_name – The QName of the binding
  • address – The address of the endpoint

Return the element for the given qualified name.

Return type:zeep.xsd.Element

Return the type for the given qualified name.

Return type:zeep.xsd.ComplexType or zeep.xsd.AnySimpleType

The default ServiceProxy instance

Return type:ServiceProxy

Set the default soap headers which will be automatically used on all calls.

Note that if you pass custom soapheaders using a list then you will also need to use that during the operations. Since mixing these use cases isn’t supported (yet).

set_ns_prefix(prefix, namespace)

Set a shortcut for the given namespace.


Return a type factory for the given namespace.


factory = client.type_factory('ns0')
user = factory.User(name='John')
Return type:Factory


class zeep.Transport(cache=None, timeout=300, operation_timeout=None, session=None)

The transport object handles all communication to the SOAP server.

  • cache – The cache object to be used to cache GET requests
  • timeout – The timeout for loading wsdl and xsd documents.
  • operation_timeout – The timeout for operations (POST/GET). By default this is None (no timeout).
  • session – A request.Session() object (optional)
get(address, params, headers)

Proxy to requests.get()

  • address – The URL for the request
  • params – The query parameters
  • headers – a dictionary with the HTTP headers.

Load the content from the given URL

post(address, message, headers)

Proxy to requests.posts()

  • address – The URL for the request
  • message – The content for the body
  • headers – a dictionary with the HTTP headers.
post_xml(address, envelope, headers)

Post the envelope xml element to the given address with the headers.

This method is intended to be overriden if you want to customize the serialization of the xml element. By default the body is formatted and encoded as utf-8. See zeep.wsdl.utils.etree_to_string.


Context manager to temporarily overrule options.


transport = zeep.Transport()
with transport.settings(timeout=10):
Parameters:timeout – Set the timeout for POST/GET operations (not used for loading external WSDL or XSD documents)


class zeep.AnyObject(xsd_object, value)

Create an any object

  • xsd_object – the xsd type
  • value – The value