Scio: API and Internals

API

class scio.client.Client(wsdl_fp, transport=None, service_class=None, type_class=None, reduce_callback=None)

WSDL client container class. Given an open wsdl file-like object, instantiating a Client builds SOAP types and service calls using a Factory, and provides access to them via the instance’s type and service attributes.

Parameters:
  • wsdl_fp – A file-like object containing the wsdl to use to construct the client types and methods.
  • transport – The transport mechanism for communicating with target services. Default: urlopen().
  • service_class – A class that will contain services. An instance of this class will be available as client.service.
  • type_class – A class that will contain types. An instance of this class will be available as client.type.
  • reduce_callback

    REQUIRED TO SUPPORT PICKLING! If you want to be able to pickle and unpickle scio types, you must supply a function that can, given a class name, return a bare instance of the type. This function must be defined at the top level of a module and must be marked as __safe_for_unpickle__. The reduce callback must have a signature compatible with the typical definition:

    def reviver(classname, proto=object, args=()):
        return proto.__new__(getattr(
            some_client.type, classname), *args)
    

    The proto parameter will only be used for a number of basic types, including int and arrays (list).

envelope(request)

Given an InputMessage, wrap in in a SOAP envelope and produce an Element.

handle_error(method, err)

Handle an exception raised by a method call that may be a SOAP Fault.

handle_response(method, response)

Handle a seemingly successful response.

parse_response(method, response)

Parse the response xml and return the soap body and header.

raise_if_fault(method, body)

Raise a SOAP Fault if one is found in the response body.

send(method, request)

Send the SOAP request for the given method. Don’t call this directly (use the methods attached to a client’s service attribute instead), but do override it in a subclass to mock a service or change how a request is sent.

class scio.client.Fault(method, faultcode, faultstring, detail)

SOAP Fault exception. The method that raised the fault, the faultcode, and faultstring are available as attributes of the exception.

class scio.client.Method(location, name, action, input, output)

Definition of a single SOAP method, including the location, action, name and input and output classes.

TODO: add a useful repr

Internals

class scio.client.AnyAttribute(name)

Minimal wrapper for untyped extra attributes.

class scio.client.AnyType(client)

Factory for runtime type lookups. When given an ‘anyType’ element, the client must look up the type to deserialize to from the type given by the element, in some attribute with a local name of ‘type’.

classmethod empty()

Return an empty instance. Like simple types, an empty anyType is just None.

scio.client.AttributeDescriptor

AttributeDescriptors are used as properties of complex types each one models an attribute or element that is part of the complex type. The descriptor mediates access to the type instance, which holds the value.

class scio.client.ComplexType(element=None, **kw)

Base class for SOAP complexTypes, at least the ones that look like classes. For each complexType in a WSDL document, the Factory creates a ComplexType subclass with the appropriate children and attributes.

class scio.client.DocumentLiteralInputFormatter(tag, namespace, nsmap, parts, headers)

Input message formatter for non-wrapped document literal messages. The main difference between this type of message and wrapped types is that there may be > 1 input part, and they are not all necessarily contained in an element with the same name as the operation.

class scio.client.DocumentLiteralWrapperInputFormatter(tag, namespace, nsmap, parts, headers)

Input message formatter that formats a document literal message with wrapper. This means that the body of the message is simply the serialized xml of the single message part, which must be a complexType element with the same name as the operation.

class scio.client.Element

Base class for xml elements and attributes

classmethod empty()

Return an empty instance of this class.

classmethod fromxml(element)

Convert value from xml. Override in typed subclasses to do type conversion.

class scio.client.EnumType(val=None, **kw)

Element representing a SOAP Enum. Subclasses have a defined set of allowed values.

class scio.client.Factory(wsdl_file)

WSDL type factory.

build(client)

Generate classes and methods for types and bindings defined in the wsdl file. Classes and methods become attributes of the type and service containers of the given client instance, respectively.

resolve(name, allow_ref=True)

Resolve a class name to a class.

class scio.client.InputFormatter(tag, namespace, nsmap, parts, headers)

Base class for input message formatters

class scio.client.InputMessage(tag, namespace, nsmap, parts, style, literal, headers)

Base of the marshalling chain for input messages. Call this with positional or keyword arguments appropriate to the message, and get back a formatter whose toxml() method will yield xml Elements for inclusion in a SOAP message.

class scio.client.MethodCall(client, method)

Pseudo-closure for a single SOAP method call.

exception scio.client.NotSOAP(msg, response, *arg, **kw)

Exception thrown when a response is received that does not contain SOAP xml. The full response is available as the response attribute of the exception.

class scio.client.OutputMessage(tag, namespace, nsmap, parts, headers)

Unmarshaller for SOAP responses. This class probably needs subclasses for all of the different binding styles.

class scio.client.RpcEncodedInputFormatter(tag, namespace, nsmap, parts, headers)

Input message formatter for rpc/enc style. A top-level element named after the operation wraps each input part, which may be a complex or simple type. Each part’s xml includes an xsi:type attribute with the value being the namespaced type of the element.

class scio.client.RpcLiteralInputFormatter(tag, namespace, nsmap, parts, headers)

Input message formatting in the RPC literal style. A top-level element named after the operation wraps each input part, which may be a complexType or simple type.

class scio.client.ServiceContainer(client)

Bucket that holds service methods. Attached to client as service attribute.

method_class

alias of MethodCall

class scio.client.SimpleType

Base class mixin for simple types. Allows simple types to be set by passing xml elements to their constructors.

classmethod adapt_args(arg, kw)

Adapt incoming arguments – which may include xml Elements – to the argument list expected by the native class of this type.

classmethod empty()

Return an empty instance of this class. Empty SimpleTypes are always None.

class scio.client.SimpleTypeMeta(name, bases, dct)

Metaclass that registers each simple type in the Element typemap.

class scio.client.TypeContainer(client)

Bucket that holds types defined in WSDL. Attached to client as type attribute.

Project Versions

Table Of Contents

Previous topic

Scio: Client

Next topic

Scio: Pickling SOAP types

This Page