The elementsoap.ElementSOAP Module

This module provides helper classes for SOAP client implementations.

Module Contents

decode(element) [#]

(Experimental) Decoder for the standard SOAP encoding scheme. This function supports SOAP arrays, and maps custom types to Python dictionaries (using accessor names as keys, and decoded elements as values).

element
Element.
Returns:
A Python object structure.
Raises ValueError:
If a subelement has an unknown type.

decode_element(element) [#]

(Experimental) Element decoder for the standard SOAP encoding scheme. This function only decodes individual elements. Use decode to handle nested data structures.

element
Element.
Returns:
A Python object, or None if the element argument was None.
Raises ValueError:
If the element has an unknown type.

NamespaceParser (class) [#]

Namespace-aware parser.

For more information about this class, see The NamespaceParser Class.

SoapElement(parent, name, type=None, text=None) ⇒ Element [#]

SOAP element factory. This creates a value element, and appends it to a parent element.

parent
The parent element (usually a SOAP request element another SOAP element).
name
Element name.
type
Element type. Use None for untyped objects, a string for types in the standard XML Schema namespace, or a QName.
text
Element value.
Returns:
A SOAP value element.

SoapFault(faultcode, faultstring, faultactor, detail) (class) [#]

SOAP fault exception.

faultcode
SOAP fault code.
faultstring
SOAP fault description.
faultactor
SOAP fault actor.
detail
SOAP detail structure (an Element structure).

For more information about this class, see The SoapFault Class.

SoapRequest(request) ⇒ Element [#]

SOAP request factory.

request
SOAP request URL.
Returns:
A SOAP request element structure.

SoapService(url=None) (class) [#]

Base class for SOAP service proxies.

url
Optional service URL. If omitted, the URL defaults to the default URL for this service (as defined by the url class attribute).

For more information about this class, see The SoapService Class.

The NamespaceParser Class

NamespaceParser (class) [#]

Namespace-aware parser. This parser attaches a namespaces attribute to all elements.

qname(element, qname) [#]

Convert a QName string to an Element-style URL/local part string. Note that the parser converts element tags and attribute names during parsing; this method should only be used on attribute values and text sections.

element
An element created by this parser.
qname
The QName string.
Returns:
The expanded URL/local part string.
Raises SyntaxError:
If the QName prefix is not defined for this element.

start(element) [#]

(Internal hook) Attach namespace attribute to element.

The SoapFault Class

SoapFault(faultcode, faultstring, faultactor, detail) (class) [#]

SOAP fault exception.

faultcode
SOAP fault code.
faultstring
SOAP fault description.
faultactor
SOAP fault actor.
detail
SOAP detail structure (an Element structure).

detail [#]

SOAP fault detail. This is either None or an Element structure.

faultactor [#]

SOAP fault actor.

faultcode [#]

SOAP fault code.

faultstring [#]

SOAP fault description.

The SoapService Class

SoapService(url=None) (class) [#]

Base class for SOAP service proxies.

url
Optional service URL. If omitted, the URL defaults to the default URL for this service (as defined by the url class attribute).

call(action, request) ⇒ Element [#]

Calls a remote SOAP method.

action
The SOAP action string.
request
Request element.
Returns:
A response element structure. This is the contents of the SOAP Body element.
Raises SoapFault:
If the server returned a SOAP Fault.
Raises HTTPError:
If the server returned an HTTP error code other than 200 (OK) or 500 (SOAP error).