\chapter{WSDL Support}

The \ZSI~and \module{ZSI.wstools} modules provide client tools for
using WSDL 1.1
(see \citetitle[http://www.w3.org/TR/wsdl]{WSDL 1.1 specification}).

ZSI provides two ways of accessing a WSDL service.  The first
provides an easy-to-use interface,
but requires setting all type codes manually.  It is easier
to use with simple services than with those specifying many
complex types.
The second method requires the use of a more complex
interface, but automatically generates type codes and classes
that correspond to XML Schema types, as well as client stub code.
Both use a \class{WSDL} instance internally to send and receive
messages (see section 11.4 for more information on the \class{WSDL}
class).

The first way of accessing a service is through the \class{ServiceProxy} class.
Once the proxy has been created, each remote operation is exposed
as a method on the object.
The user must handle the generation of type codes.
Note that while \class{ServiceProxy} is part of \ZSI{}, it must be
explicitly imported.

The second method uses wsdl2py.  Handling XML Schema
(see \citetitle[http://www.w3.org/XML/Schema]{XML Schema specification}) 
is one of the more difficult aspects
of using WSDL.  The class \class{WriteServiceModule}, which wsdl2py
uses, helps to hides these
details.  It generates a module with stub code for the client interface,
and a module that encapsulates the handling of XML Schema, automatically
generating type codes.

\section{WSDLReader}

The \class{WSDLReader} class in \module{ZSI.wstools.WSDLTools} provides
methods for loading WSDL service descriptions from URLs, XML files
or XML string data, and creating a \class{WSDL} object.
It is used by \class{ServiceProxy} and \class{WriteServiceModule}.

\class{WSDL} instances represent WSDL service descriptions and provide 
a low-level object model for building and working with those descriptions.

The WSDL reader is implemented as a 
separate class to make it easy to create custom readers that implement 
caching policies or other optimizations.


\begin{classdesc}{WSDLReader}{}

The following methods are available:

\begin{methoddesc}{loadFromStream}{file}
Return a \class{WSDL} instance representing the service description 
contained in \var{file}. The \var{file} argument must be a file-like 
object.
\end{methoddesc}

\begin{methoddesc}{loadFromString}{data}
Returns a \class{WSDL} instance loaded from the XML string \var{data}.
\end{methoddesc}

\begin{methoddesc}{loadFromFile}{filename}
Returns a \class{WSDL} instance loaded from the file named by \var{filename}.
\end{methoddesc}

\begin{methoddesc}{loadFromURL}{url}
Returns a \class{WSDL} instance loaded from the given \var{url}.
\end{methoddesc}

\end{classdesc}

\section{ServiceProxy}

The \class{ServiceProxy} class provides calls to
web services. A WSDL description must be available for the 
service.  \class{ServiceProxy} uses \class{WSDLReader} internally to load 
a \class{WSDL} instance.

The user may build up a type codes module for use by \class{ServiceProxy}.

\begin{classdesc}{ServiceProxy}{wsdl,\optional{, service\optional{, port}}}

The \var{wsdl} argument may be either the URL of the service description 
or an existing \class{WSDL} instance. The optional \var{service} and 
\var{port} name the service and port within the WSDL description that 
should be used. If not specified, the first defined service and port 
will be used.

The following keyword arguments may be used:

\begin{tableiii}{l|c|p{30em}}{textrm}{Keyword}{Default}{Description}
\lineiii{\code{nsdict}}{\code{\{\}}}{Namespace dictionary to send in the
    SOAP \code{Envelope}}
\lineiii{\code{tracefile}}{\code{None}}{An object with a \code{write}
    method, where packet traces will be recorded.}
\end{tableiii}

A \class{ServiceProxy} instance, once instantiated, exposes callable 
methods that reflect the methods of the remote web service it 
represents. These methods may be called like normal methods, using 
*either* positional or keyword arguments (but not both).

The methods can be called with either positional or keyword arguments;
the argument types must be compatible with the types specified in the
WSDL description.

When a method of a \class{ServiceProxy} is called with positional 
arguments, the arguments are mapped to the SOAP request based on 
the parameter order defined in the WSDL description. If keyword 
arguments are passed, the arguments will be mapped based on their 
names.

\end{classdesc}

\subsection{Example}

The following example, using ServiceProxy,  shows a simple language
translation service that makes
use of the complex type structures defined in the module BabelTypes:

\begin{verbatim}
from ZSI import ServiceProxy
import BabelTypes

service = ServiceProxy('http://www.xmethods.net/sd/BabelFishService.wsdl',
		       typesmodule=BabelTypes)
value = service.BabelFish('en_de', 'This is a test!')
\end{verbatim}

The return value from a proxy method depends on the SOAP signature. If the 
remote service returns a single value, that value will be returned. If the 
remote service returns multiple ``out'' parameters, the return value of the 
proxy method will be a dictionary containing the out parameters indexed by 
name.  Because \class{ServiceProxy} makes use of the ZSI serialization / 
deserialization engine, complex return types are supported.  This means 
that an aggregation of primitives can be returned from or passed to a service
invocation according to any predefined hierarchical structure.


\section{Code Generation from WSDL and XML Schema}

This section covers wsdl2py, the second way ZSI provides to access WSDL
services.  Given the path to a WSDL service, two files are generated, a 
'service' file and a 'types' file, that one can then use to access the
service.  For example, to generate code to access the TerraServer database,
the script can be called as follows:

\begin{verbatim}
wsdl2py http://terraservice.net/TerraService.asmx?WSDL
\end{verbatim}

To generate the 'service' file, wsdl2py uses the \class{WriteServiceModule}
class in \module{ZSI.wsdl2python}.
\class{WriteServiceModule} transforms the definitions in a WSDL instance
to remote proxy interfaces in the 'service' file.
To generate the 'types' file, wsdl2py transforms the XML Schema instances in
the WSDL types section to type codes that describe
the data.

The \class{WSDL} (see section 11.4) class and \module{ZSI.wstools.XMLSchema}
module provide API's into the
definitions, which \class{ModuleWriter} and its underlying generator classes
use to interpret WSDL and XML Schema into class definitions.

The 'service' file contains locator, portType, and message classes.  
A locator instance is used to
get an instance of a portType class, which is a remote proxy object.
Message instances are sent and received through the methods of the
portType instance.

The 'types' file contains class representations of the definitions and
declarations defined by all schema instances imported by the WSDL definition.
XML Schema attributes, wildcards, and derived types are not fully
handled.

\subsection{WriteServiceModule Class Description}

\begin{classdesc}{WriteServiceModule}{wsdl, \optional{importlib,
\optional{typewriter}}}

This class generates a module containing client stub code, and a module
encapsulating the use of XML Schema instances, given a \class{WSDL}
instance generated by \class{WSDLReader}.
It handles import, namespace, and schema complexities, and class definition
order.

\class{WriteServiceModule} delegates to \class{ServiceDescription} the
interpretation
of the service definition, and to \class{SchemaDescription} the interpretation
of the schema definition.  (These two classes are only intended to be called
by \class{WriteServiceModule}, but are described here to indicate what
is going on behind the scenes.)

The following method is available:

\begin{methoddesc}{write}{}
Generates the client code.
\end{methoddesc}

\end{classdesc}

\begin{classdesc}{ServiceDescription}{}
Interprets the service definition, and creates the client interface and
port descriptions code.  It delegates to \class{MessageWriter}, which
generates a message's class definition, and to \class{PartWriter}, which
generates a message part's description.
\end{classdesc}

\begin{classdesc}{SchemaDescription}{}
Interprets the schema definition, generating typecode module code
for all global definitions and declarations in a schema instance.
It delegates to \class{TypeWriter}, which generates a type's
description/typecode.
\end{classdesc}

The following excerpt is from wsdl2py, and illustrates how
\class{WriteServiceModule} is used.  The input is a 
path name of a WSDL file or URL.

\begin{verbatim}
    ...
    reader = WSDLTools.WSDLReader()
    if args_d['fromfile']:
        wsdl = reader.loadFromFile(args_d['wsdl'])
    elif args_d['fromurl']:
        wsdl = reader.loadFromURL(args_d['wsdl'])
    wsm = ZSI.wsdl2python.WriteServiceModule(wsdl)
    wsm.write()
    ...
\end{verbatim}


\subsection{Example Use of Generated Code}

The following shows how to call a proxy method for
ConvertPlaceToLonLatPt, a method provided by a service
named TerraService. It assumes that wsdl2py has already been called.
In this case, the 'services' and 'types' files generated would
be named TerraService_services.py and TerraService_services_types.py,
respectively.

\begin{verbatim}
from TerraService_services import *

import sys

def main():
    loc = TerraServiceLocator()

       # prints messages sent and received if tracefile is set
    kw = { 'tracefile' : sys.stdout }
    portType = loc.getTerraServiceSoap(**kw)

    # --------------------------------
    # From "TerraService_services.py"
    #
    #  ConvertPlaceToLonLatPtSoapIn = ns0.ConvertPlaceToLonLatPt_Dec().pyclass

    # --------------------------------
    # From "TerraService_services_types.py"
    #
    #  class ConvertPlaceToLonLatPt_Dec(ZSI.TCcompound.Struct, ElementDeclaration):
    #      ...
    #      class Holder(SetAddByAname):
    #          typecode = self
    #          def __init__(self):
    #              # pyclass
    #              self._place = None
    #
    class Holder: pass
    request = ConvertPlaceToLonLatPtSoapIn()
    request._place = Holder()
    request._place._City = 'Oak Harbor'
    request._place._State = 'Washington'
    request._place._Country = 'United States'

    response = portType.ConvertPlaceToLonLatPt(request)
    print "Latitude = %s" % response._ConvertPlaceToLonLatPtResult._Lat
    print "Longitude = %s" % response._ConvertPlaceToLonLatPtResult._Lon
...

\end{verbatim}

One needs to look at the associated WSDL file to see how
to use the classes and methods in the generated code.
In this example, \class{TerraServiceLocator}
is a class with the name of the WSDL service, plus 'Locator'.  It contains the
information necessary to contact the service, using
\method{getTerraServiceSoap(**kw)}.

That method's name is generated by 'get' plus the name of the WSDL portType
for the service.  It returns a class which
encapsulates the information in the portType, and contains the proxies
for the methods associated with it.

\method{ConvertPlaceToLonLatPtSoapInWrapper()}'s
name is generated using
the name of the WSDL input message for the ConvertPlaceToLonLatPt
WSDL operation, plus 'Wrapper'.  The actual call to the service is a method of
the class encapsulating the portType, with the same name as the WSDL operation.

The name of the response field is '_' plus the name of the
WSDL element (or one contained by the element) returned by the call.
Parameters that are input and output are subfields of
the request object and the response field, respectively. 
Their names can be determined by looking at the part sub-element of a
message.

If the user wishes to set authorization headers in a request, using the 
previous example, it would be accomplished like this:

\begin{verbatim}
def main():
    loc = TerraServiceLocator()
    portType = loc.getTerraServiceSoap(
        tracefile=sys.stdout,
        auth=(soap.ZSI.AUTH.httpbasic, 'logname', 'password'))
    # ...
\end{verbatim}

\section{WSDL objects}

The following classes described encapsulate the upper-level objects
in a WSDL file.  Note that most users will not need to use these,
given the availability of \class{WriteServiceModule} and
\class{ServiceProxy}, which are built on top of these objects.

There are quite many classes defined here to
implement the WSDL object model. Instances of those classes are generally 
accessed and created through container objects rather than instantiated 
directly. Most of them simply implement a straightforward representation of 
the WSDL elements they represent. The interfaces of these objects are 
described in the next section.

An exception is defined for errors that occur while creating WSDL objects.

\begin{excdesc}{WSDLError}
This exception is raised when errors occur in the parsing or building of 
WSDL objects, usually indicating invalid structure or usage.
It is a subtype of Python's \exception{Exception} class.
\end{excdesc}

\begin{classdesc}{WSDL}{}

\class{WSDL} instances implement the WSDL object model. They are
created by loading an XML source into a \class{WSDLReader} object.

A \class{WSDL} object provides access to all of the structures that make 
up a web service description. The various ``collections'' in the WSDL 
object model (services, bindings, portTypes, etc.) are implemented as 
\class{Collection} objects that behave like ordered mappings.

The following attributes are read-only:

\begin{memberdesc}{name}
The name of the service description (associated with the \emph{definitions} 
element), or \code{None} if not specified.
\end{memberdesc}

\begin{memberdesc}{targetNamespace}
The target namespace associated with the service description, or 
\code{None} if not specified.
\end{memberdesc}

\begin{memberdesc}{documentation}
The documentation associated with the \emph{definitions} element of the 
service description, or the empty string if not specified.
\end{memberdesc}

\begin{memberdesc}{location}
The URL from which the service description was loaded, or \code{None} 
if the description was not loaded from a URL.
\end{memberdesc}

\begin{memberdesc}{services}
A collection that contains \class{Service} objects that represent the 
services that appear in the service description. The items of this 
collection may be indexed by name or ordinal. 
\end{memberdesc}

\begin{memberdesc}{messages}
A collection that contains \class{Message} objects that represent the 
messages that appear in the service description. The items of this 
collection may be indexed by name or ordinal. 
\end{memberdesc}

\begin{memberdesc}{portTypes}
A collection that contains \class{PortType} objects that represent the 
portTypes that appear in the service description. The items of this 
collection may be indexed by name or ordinal. 
\end{memberdesc}

\begin{memberdesc}{bindings}
A collection that contains \class{Binding} objects that represent the 
bindings that appear in the service description. The items of this 
collection may be indexed by name or ordinal. 
\end{memberdesc}

\begin{memberdesc}{imports}
A collection that contains \class{ImportElement} objects that represent the 
import elements that appear in the service description. The items of this 
collection may be indexed by ordinal or the target namespace URI of the 
import element.
\end{memberdesc}

\begin{memberdesc}{types}
A \class{Types} instance that contains \class{XMLSchema} objects that 
represent the schemas defined or imported by the WSDL description. The 
\class{Types} object may be indexed by ordinal or by targetNamespace to 
lookup schema objects.
\end{memberdesc}

\begin{memberdesc}{extensions}
A sequence of objects that represent WSDL \emph{extension elements}. These 
objects may be instances of classes that represent WSDL-defined extensions 
(\class{SoapBinding}, \class{SoapBodyBinding}, etc.), or DOM \class{Element} 
objects for unknown extensions.
\end{memberdesc}

\end{classdesc}

\begin{classdesc}{Service}{}
A \class{Service} object represents a WSDL \code{<service>} element.

The following attributes are read-only:

\begin{memberdesc}{name}
The name of the service.
\end{memberdesc}

\begin{memberdesc}{documentation}
The documentation associated with the element, or an empty string.
\end{memberdesc}

\begin{memberdesc}{ports}
A collection that contains \class{Port} objects that represent the 
ports defined by the service. The items of this collection may be indexed 
by name or ordinal. 
\end{memberdesc}

\begin{memberdesc}{extensions}
A sequence of any contained WSDL extensions.
\end{memberdesc}

The following method is available:

\begin{methoddesc}{getWSDL}{}
Return the parent \class{WSDL} instance of the object.
\end{methoddesc}

\end{classdesc}


\begin{classdesc}{Port}{}

A \class{Port} object represents a WSDL \code{<port>} element.

The following attributes are read-only:

\begin{memberdesc}{name}
The name of the port.
\end{memberdesc}

\begin{memberdesc}{documentation}
The documentation associated with the element, or an empty string.
\end{memberdesc}

\begin{memberdesc}{binding}
The name of the binding associated with the port.
\end{memberdesc}

\begin{memberdesc}{extensions}
A sequence of any contained WSDL extensions.
\end{memberdesc}

The following methods are available:

\begin{methoddesc}{getAddressBinding}{}
A convenience method that returns the address binding extension for the 
port, either a \class{SoapAddressBinding} or \class{HttpAddressBinding}.
Raises \exception{WSDLError} if no address binding is found.
\end{methoddesc}

\begin{methoddesc}{getService}{}
Return the parent \class{Service} instance of the object.
\end{methoddesc}

\begin{methoddesc}{getBinding}{}
Return the \class{Binding} instance associated with the port.
\end{methoddesc}

\begin{methoddesc}{getPortType}{}
Return the \class{PortType} instance associated with the port.
\end{methoddesc}

\end{classdesc}

\begin{classdesc}{PortType}{}

A \class{PortType} object represents a WSDL \code{<portType>} element.

The following attributes are read-only:

\begin{memberdesc}{name}
The name of the portType.
\end{memberdesc}

\begin{memberdesc}{documentation}
The documentation associated with the element, or an empty string.
\end{memberdesc}

\begin{memberdesc}{operations}
A collection that contains \class{Operation} objects that represent the 
operations in the portType. The items of this collection may be indexed 
by name or ordinal. 
\end{memberdesc}

The following method is available:

\begin{methoddesc}{getWSDL}{}
Return the parent \class{WSDL} instance of the object.
\end{methoddesc}

\end{classdesc}

\begin{classdesc}{Operation}{}

A \class{Operation} object represents a WSDL \code{<operation>} element 
within a \code{portType} element.

The following attributes are read-only:

\begin{memberdesc}{name}
The name of the operation.
\end{memberdesc}

\begin{memberdesc}{documentation}
The documentation associated with the element, or an empty string.
\end{memberdesc}

\begin{memberdesc}{parameterOrder}
A string representing the \code{parameterOrder} attribute of the operation, 
or \code{None} if the attribute is not defined.
\end{memberdesc}

\begin{memberdesc}{input}
A \class{MessageRole} instance representing the \code{<input>} element of 
the operation binding, or \code{None} if no input element is present.
\end{memberdesc}

\begin{memberdesc}{output}
A \class{MessageRole} instance representing the \code{<output>} element of 
the operation, or \code{None} if no output element is present.
\end{memberdesc}

\begin{memberdesc}{faults}
A collection of \class{MessageRole} instances representing the \code{<fault>} 
elements of the operation.
\end{memberdesc}

The following methods are available:

\begin{methoddesc}{getPortType}{}
Return the parent \class{PortType} instance of the object.
\end{methoddesc}

\begin{methoddesc}{getInputMessage}{}
Return \class{Message} object associated with the input to the operation.
\end{methoddesc}

\begin{methoddesc}{getOutputMessage}{}
Return \class{Message} object associated with the output of the operation.
\end{methoddesc}

\begin{methoddesc}{getFaultMessage}{name}
Return \class{Message} object associated with the named fault.
\end{methoddesc}

\end{classdesc}

\begin{classdesc}{MessageRole}{}

\class{MessageRole} objects represent WSDL \code{<input>}, \code{<output>} 
and \code{<fault>} elements within an operation.

The following attributes are read-only:

\begin{memberdesc}{name}
The name attribute of the element.
\end{memberdesc}

\begin{memberdesc}{type}
The type of the element, one of \code{'input'}, \code{'output'} or 
\code{'fault'}.
\end{memberdesc}

\begin{memberdesc}{message}
The name of the message associated with the object.
\end{memberdesc}

\begin{memberdesc}{documentation}
The documentation associated with the element, or an empty string.
\end{memberdesc}

\end{classdesc}

\begin{classdesc}{Binding}{}

A \class{Binding} object represents a WSDL \code{<binding>} element.

The following attributes are read-only:

\begin{memberdesc}{name}
The name of the binding.
\end{memberdesc}

\begin{memberdesc}{documentation}
The documentation associated with the element, or an empty string.
\end{memberdesc}

\begin{memberdesc}{type}
The name of the portType the binding is associated with.
\end{memberdesc}

\begin{memberdesc}{operations}
A collection that contains \class{OperationBinding} objects that represent 
the contained operation bindings.
\end{memberdesc}

\begin{memberdesc}{extensions}
A sequence of any contained WSDL extensions.
\end{memberdesc}

The following methods are available:

\begin{methoddesc}{getWSDL}{}
Return the parent \class{WSDL} instance of the object.
\end{methoddesc}

\begin{methoddesc}{getPortType}{}
Return the \class{PortType} object associated with the binding.
\end{methoddesc}

\begin{methoddesc}{findBinding}{kind}
Find a binding extension in the binding. The \var{kind} can be a class 
object if the wanted extension is one of the WSDL-defined types (such as 
\class{SoapBinding} or \class{HttpBinding}). If the extension is not one of 
the supported types, \var{kind} can be a tuple of the form 
\code{(namespace-URI, localname)}, which will be used to try to find a 
matching DOM \class{Element}.
\end{methoddesc}

\begin{methoddesc}{findBindings}{kind}
The same as \method{findBinding()}, but will return multiple values of 
the given \var{kind}.
\end{methoddesc}

\end{classdesc}

\begin{classdesc}{OperationBinding}{}

A \class{OperationBinding} object represents a WSDL \code{<operation>} 
element within a binding element.

The following attributes are read-only:

\begin{memberdesc}{name}
The name of the operation binding.
\end{memberdesc}

\begin{memberdesc}{documentation}
The documentation associated with the element, or an empty string.
\end{memberdesc}

\begin{memberdesc}{input}
A \class{MessageRoleBinding} instance representing the \code{<input>} 
element of the operation binding, or \code{None} if no input element is 
present.
\end{memberdesc}

\begin{memberdesc}{output}
A \class{MessageRoleBinding} instance representing the \code{<output>} 
element of the operation binding, or \code{None} if no output element is 
present.
\end{memberdesc}

\begin{memberdesc}{faults}
A collection of \class{MessageRoleBinding} instances representing the 
\code{<fault>} elements of the operation binding.
\end{memberdesc}

\begin{memberdesc}{extensions}
A sequence of any contained WSDL extensions.
\end{memberdesc}

The following methods are available:

\begin{methoddesc}{getBinding}{}
Return the parent \class{Binding} instance of the operation binding.
\end{methoddesc}

\begin{methoddesc}{getOperation}{}
Return the abstract \class{Operation} associated with the operation binding.
\end{methoddesc}

\begin{methoddesc}{findBinding}{kind}
Find a binding extension in the operation binding. The \var{kind} can be a 
class object if the wanted extension is one of the WSDL-defined types (such 
as \class{SoapOperationsBinding} or \class{HttpOperationBinding}). 

If the extension is not one of the supported types, \var{kind} can be a
tuple of the form \code{(namespace-URI, localname)}, which will be used to 
try to find a matching DOM \class{Element}.
\end{methoddesc}

\begin{methoddesc}{findBindings}{kind}
The same as \method{findBinding()}, but will return multiple values of 
the given \var{kind}.
\end{methoddesc}

\end{classdesc}


\begin{classdesc}{MessageRoleBinding}{}

\class{MessageRoleBinding} objects represent WSDL \code{<input>}, 
\code{<output>} and \code{<fault>} elements within an operation binding.

The following attributes are read-only:

\begin{memberdesc}{name}
The name attribute of the element, for fault elements. This is always 
\code{None} for input and output elements.
\end{memberdesc}

\begin{memberdesc}{type}
The type of the element, one of \code{'input'}, \code{'output'} or 
\code{'fault'}.
\end{memberdesc}

\begin{memberdesc}{documentation}
The documentation associated with the element, or an empty string.
\end{memberdesc}

\begin{memberdesc}{extensions}
A sequence of any contained WSDL extensions.
\end{memberdesc}

The following methods are available:

\begin{methoddesc}{findBinding}{kind}
Find a binding extension in the message role binding. The \var{kind} can be a 
class object if the wanted extension is one of the WSDL-defined types.

If the extension is not one of the supported types, \var{kind} can be a
tuple of the form \code{(namespace-URI, localname)}, which will be used to 
try to find a matching DOM \class{Element}.
\end{methoddesc}

\begin{methoddesc}{findBindings}{kind}
The same as \method{findBinding()}, but will return multiple values of 
the given \var{kind}.
\end{methoddesc}

\end{classdesc}


\begin{classdesc}{Message}{}

A \class{Message} object represents a WSDL \code{<message>} element.

The following attributes are read-only:

\begin{memberdesc}{name}
The name of the message.
\end{memberdesc}

\begin{memberdesc}{documentation}
The documentation associated with the element, or an empty string.
\end{memberdesc}

\begin{memberdesc}{parts}
A collection that contains \class{MessagePart} objects that represent the 
parts of the message. The items of this collection may be indexed 
by name or ordinal. 
\end{memberdesc}
\end{classdesc}


\begin{classdesc}{MessagePart}{}

A \class{MessagePart} object represents a WSDL \code{<part>} element.

The following attributes are read-only:

\begin{memberdesc}{name}
The name of the message part.
\end{memberdesc}

\begin{memberdesc}{documentation}
The documentation associated with the element, or an empty string.
\end{memberdesc}

\begin{memberdesc}{type}
A tuple of the form \code{(namespace-URI, localname)}, or \code{None} 
if the \member{type} attribute is not defined.
\end{memberdesc}

\begin{memberdesc}{element}
A tuple of the form \code{(namespace-URI, localname)}, or \code{None} 
if the \member{element} attribute is not defined.
\end{memberdesc}
\end{classdesc}


\begin{classdesc}{Types}{}

The following attributes are read-only:

A \class{Types} object represents a WSDL \code{<types>} element. It acts 
as an ordered collection containing \class{XMLSchema} instances associated 
with the service description (either directly defined in a \code{<types>} 
element, or included via import). The \class{Types} object can be indexed 
by ordinal or by the \code{targetNamespace} of the contained schemas.

\begin{memberdesc}{documentation}
The documentation associated with the element, or an empty string.
\end{memberdesc}

\begin{memberdesc}{extensions}
A sequence of any contained WSDL extensions.
\end{memberdesc}

The following method is available:

\begin{methoddesc}{getWSDL}{}
Return the parent \class{WSDL} instance of the object.
\end{methoddesc}
\end{classdesc}

\begin{classdesc}{ImportElement}{}

A \class{ImportElement} object represents a WSDL \code{<import>} element.

The following attributes are read-only:

\begin{memberdesc}{namespace}
The namespace attribute of the import element.
\end{memberdesc}

The following method is available:

\begin{memberdesc}{location}
The location attribute of the import element.
\end{memberdesc}
\end{classdesc}


\subsection{Binding Classes}

The \module{WSDLTools} module contains a number of classes that represent 
the binding extensions defined in the WSDL specification. These classes 
are straightforward, reflecting the attributes of the corresponding 
XML elements, so they are not documented exhaustively here.

\begin{classdesc}{SoapBinding}{transport\optional{, style}}
Represents a \code{<soap:binding>} element.
\end{classdesc}

\begin{classdesc}{SoapAddressBinding}{location}
Represents a \code{<soap:address>} element.
\end{classdesc}

\begin{classdesc}{SoapOperationBinding}{}
Represents a \code{<soap:operation>} element.
\end{classdesc}

\begin{classdesc}{SoapBodyBinding}{}
Represents a \code{<soap:body>} element.
\end{classdesc}

\begin{classdesc}{SoapFaultBinding}{}
Represents a \code{<soap:fault>} element.
\end{classdesc}

\begin{classdesc}{SoapHeaderBinding}{}
Represents a \code{<soap:header>} element.
\end{classdesc}

\begin{classdesc}{SoapHeaderFaultBinding}{}
Represents a \code{<soap:headerfault>} element.
\end{classdesc}

\begin{classdesc}{HttpBinding}{}
Represents a \code{<http:binding>} element.
\end{classdesc}

\begin{classdesc}{HttpAddressBinding}{}
Represents a \code{<http:address>} element.
\end{classdesc}

\begin{classdesc}{HttpOperationBinding}{}
Represents a \code{<http:operation>} element.
\end{classdesc}

\begin{classdesc}{HttpUrlReplacementBinding}{}
Represents a \code{<http:urlReplacement>} element.
\end{classdesc}

\begin{classdesc}{HttpUrlEncodedBinding}{}
Represents a \code{<http:urlEncoded>} element.
\end{classdesc}

\begin{classdesc}{MimeMultipartRelatedBinding}{}
Represents a \code{<mime:multipartRelated>} element.
\end{classdesc}

\begin{classdesc}{MimePartBinding}{}
Represents a \code{<mime:part>} element.
\end{classdesc}

\begin{classdesc}{MimeContentBinding}{}
Represents a \code{<mime:content>} element.
\end{classdesc}

\begin{classdesc}{MimeXmlBinding}{}
Represents a \code{<mime:mimeXml>} element.
\end{classdesc}

