Table Of Contents

Previous topic

Models

Next topic

Protocols

This Page

Interfaces

The spyne.interface package contains the implementations of various interface document standards.

Interface Class

class spyne.interface.Interface(app=None, import_base_namespaces=False)

Bases: object

The Interface class holds all information needed to build an interface document.

Parameters:app – A spyne.application.Application instance.
get_class(key)

Returns the class definition that corresponds to the given key. Keys are in ‘{namespace}class_name’ form, a.k.a. XML QName format.

Not meant to be overridden.

get_class_instance(key)

Returns the default class instance that corresponds to the given key. Keys are in ‘{namespace}class_name’ form, a.k.a. XML QName format. Classes should not enforce arguments to the constructor.

Not meant to be overridden.

get_name()

Returns service name that is seen in the name attribute of the definitions tag.

Not meant to be overridden.

get_namespace_prefix(ns)

Returns the namespace prefix for the given namespace. Creates a new one automatically if it doesn’t exist.

Not meant to be overridden.

get_tns()

Returns default namespace that is seen in the targetNamespace attribute of the definitions tag.

Not meant to be overridden.

has_class(cls)

Returns true if the given class is already included in the interface object somewhere.

populate_interface(types=None)

Harvests the information stored in individual classes’ _type_info dictionaries. It starts from function definitions and includes only the used objects.

tns

Returns default namespace that is seen in the targetNamespace attribute of the definitions tag.

Not meant to be overridden.

Interface Document Base Class

class spyne.interface.InterfaceDocumentBase(interface)

Bases: object

Base class for all interface document implementations.

Parameters:interface – A spyne.interface.InterfaceBase instance.
build_interface_document(cls)

This function is supposed to be called just once, as late as possible into the process start. It builds the interface document and caches it somewhere. The overriding function should never call the overridden function as this may result in the same event firing more than once.

get_interface_document(cls)

This function is called by server transports that try to satisfy the request for the interface document. This should just return a previously cached interface document.

XML Schema

class spyne.interface.xml_schema._base.XmlSchema(interface)[source]

The implementation of a subset of the Xml Schema 1.0 object definition document standard.

The standard is available in three parts as follows: http://www.w3.org/TR/xmlschema-0/ http://www.w3.org/TR/xmlschema-1/ http://www.w3.org/TR/xmlschema-2/

Parameters:interface – A spyne.interface.InterfaceBase instance.
Supported events:
  • document_built:

    Called right after the document is built. The handler gets the XmlSchema instance as the only argument.

  • xml_document_built:

    Called right after the document is built. The handler gets the XmlSchema instance as the only argument. Only called from this class.

build_validation_schema()[source]

Build application schema specifically for xml validation purposes.

get_schema_info(prefix)[source]

Returns the SchemaInfo object for the corresponding namespace. It creates it if it doesn’t exist.

The SchemaInfo object holds the simple and complex type definitions for a given namespace.

get_schema_node(pref)[source]

Return schema node for the given namespace prefix.

Wsdl 1.1

The spyne.interface.wsdl.wsdl11 module contains an implementation of a subset of the Wsdl 1.1 document standard and its helper methods.

class spyne.interface.wsdl.wsdl11.Wsdl11(interface=None, _with_partnerlink=False)[source]

The implementation of the Wsdl 1.1 interface definition document standard which is avaible here: http://www.w3.org/TR/wsdl

Parameters:
  • app – The parent application.
  • _with_partnerlink – Include the partnerLink tag in the wsdl.
Supported events:
  • document_built:

    Called right after the document is built. The handler gets the Wsdl11 instance as the only argument. Also called by XmlSchema class.

  • wsdl_document_built:

    Called right after the document is built. The handler gets the Wsdl11 instance as the only argument. Only called from this class.

build_interface_document(url)[source]

Build the wsdl for the application.

build_validation_schema()

Build application schema specifically for xml validation purposes.

get_schema_info(prefix)

Returns the SchemaInfo object for the corresponding namespace. It creates it if it doesn’t exist.

The SchemaInfo object holds the simple and complex type definitions for a given namespace.

get_schema_node(pref)

Return schema node for the given namespace prefix.