[Zope-CVS] CVS: Packages/WebService/doc - Makefile:1.1 SOAPCallInfo.tex:1.1 SOAPMessage.tex:1.1 SOAPReader.tex:1.1 SOAPWriter.tex:1.1 ServiceProxy.tex:1.1 Transports.tex:1.1 Utility.tex:1.1 WSDLTools.tex:1.1 WebService.css:1.1 WebService.html:1.1 WebService.pdf:1.1 WebService.ps:1.1 WebService.tex:1.1 XMLSchema.tex:1.1 XMLWriter.tex:1.1
Brian Lloyd
brian@digicool.com
Mon, 26 Nov 2001 11:18:24 -0500
Update of /cvs-repository/Packages/WebService/doc
In directory cvs.zope.org:/tmp/cvs-serv23779/WebService/doc
Added Files:
Makefile SOAPCallInfo.tex SOAPMessage.tex SOAPReader.tex
SOAPWriter.tex ServiceProxy.tex Transports.tex Utility.tex
WSDLTools.tex WebService.css WebService.html WebService.pdf
WebService.ps WebService.tex XMLSchema.tex XMLWriter.tex
Log Message:
Initial commit of web services package.
=== Added File Packages/WebService/doc/Makefile ===
## Documentation Makefile
PACKAGE= WebService
SECTIONS=
PYSRCDIR= /projects/python/Python-2.1
MKHOWTO= $(PYSRCDIR)/Doc/tools/mkhowto
PAPER= letter
M= $(PACKAGE)
SOURCES= $M.tex $(SECTIONS)
all: dvi ps pdf html
dvi: $M.dvi
pdf: $M.pdf
ps: $M.ps
html: $M.html
$M.dvi: $(SOURCES)
$(MKHOWTO) --dvi $M.tex
$M.pdf: $(SOURCES)
$(MKHOWTO) --pdf $M.tex
$M.ps: $M.dvi
dvips -N0 -t $(PAPER) -o $@ $M.dvi
$M.html: $(SOURCES)
$(MKHOWTO) --html --split=1 $M.tex
mv $M/$M.html $M/$M.css .
rm -rf $M
clean:
rm -f *.aux *.idx *.ilg *.ind *.log *.toc *.bkm *.syn *.pla *.how
clobber: clean
rm -f $M.dvi $M.ps $M.pdf $M.html $M.l2h $M.css
=== Added File Packages/WebService/doc/SOAPCallInfo.tex ===
\section{\module{WebService.SOAPCallInfo}}
\declaremodule{}{WebService.SOAPCallInfo}
The \module{SOAPCallInfo} module provides tools for describing and
inspecting the binding and parameter information needed to invoke
operations on SOAP web services.
WSDL provides a flexible and extensible way of describing a SOAP method
invokation in great detail. As a result, the WSDL object model is fairly
complex and it can be quite cumbersome to use that object model directly
to find all of the information you need to know in order to call a SOAP
service.
The \class{SOAPCallInfo} class defined in this module provides a more
compact representation of call metadata that is often easier to work
with than raw WSDL structures. \class{SOAPCallInfo} instances can be
created from WSDL information, or can built dynamically (for example,
to use as input to a \class{WSDLWriter}).
\begin{funcdesc}{callInfoFromWSDL}{port, name}
Return a new \class{SOAPCallInfo} instance intitialized from WSDL data.
The \var{port} should be a \class{Port} instance from a \class{WSDL}
object, and \var{name} should be the name of the operation within that
port.
\end{funcdesc}
\begin{classdesc}{SOAPCallInfo}{methodName}
A \class{SOAPCallInfo} instance represents the important metadata related
to a SOAP operation invokation, such as the name of the operation, address,
parameters, types and other binding information. The \var{methodName}
argument indicates the name of the SOAP operation.
\end{classdesc}
\subsection{SOAPCallInfo Objects}
\class{SOAPCallInfo} objects support attributes and methods to represent
and manipulate the various metadata associated with a SOAP operation
invokation.
Note that unless otherwise specified, the various public attributes of
\class{SOAPCallInfo} instances have a default value of \code{None}. For
\class{SOAPCallInfo} objects loaded from WSDL, a value of \code{None}
indicates that the WSDL did not define a value for the attribute.
\begin{memberdesc}{documentation}
A string containing documentation for the web service operation. This
defaults to an empty string.
\end{memberdesc}
\begin{memberdesc}{encodingStyle}
A string indicating the URIs of one or more encoding styles to be used
when calling the operation. The URIs are separated by single spaces
if more than one encoding is applicable. The default value for this
attribute is the standard SOAP 1.1 encoding URI.
\end{memberdesc}
\begin{memberdesc}{soapAction}
The SOAP action associated with the operation, usually sent to remote
service implementations as a MIME header value.
\end{memberdesc}
\begin{memberdesc}{location}
The address of the service implementation. This is the target URL for
requests to the web service operation.
\end{memberdesc}
\begin{memberdesc}{methodName}
The name of the operation, used as the element name of the RPC struct
in RPC-style SOAP messages.
\end{memberdesc}
\begin{memberdesc}{namespace}
The namespace of the operation, used as the namespace URI of the RPC struct
in RPC-style SOAP messages.
\end{memberdesc}
\begin{memberdesc}{transport}
A namespace URI indicating the transport to be used to communicate with
the operation. This value should be one of the URIs defined by the WSDL
specification for this purpose.
\end{memberdesc}
\begin{memberdesc}{style}
The SOAP message style to be used when calling the operation. Valid values
for this attribute are \code{'document'} and \code{'rpc'}. The default
value for this attribute is \code{'rpc'}.
\end{memberdesc}
\begin{memberdesc}{use}
This attribute indicates encoding usage for calling the operation. Valid
values for this attribute are \code{'literal'} and \code{'encoded'}, per
the WSDL specification. The default value for this attribute is
\code{'encoded'}.
\end{memberdesc}
\begin{methoddesc}[SOAPCallInfo]{addInParameter}{name, type,
\optional{, namespace\optional{, element_type}}
}
Add an input parameter description to the call info object. The \var{name}
indicates the name of the parameter. The \var{type} should be a QName tuple
of the form \code{(namespaceURI, typeName)} that indicates an XSD simpleType,
complexType or element associated with the parameter.
The optional \var{namespace}, if specified, indicates a namespace URI to
be used for element serialization. A true value may be passed for the
optional \var{element_type} to indicate that \var{type} is a reference to
an XSD element rather than a simpleType or complexType.
\end{methoddesc}
\begin{methoddesc}[SOAPCallInfo]{addOutParameter}{name, type,
\optional{, namespace\optional{, element_type}}
}
Add an output parameter description to the call info object. Arguments
and usage is the same as for \method{addInParameter()}.
\end{methoddesc}
\begin{methoddesc}[SOAPCallInfo]{setReturnParameter}{name, type,
\optional{, namespace\optional{, element_type}}
}
Set the return parameter description for the call info object.
\end{methoddesc}
\begin{methoddesc}[SOAPCallInfo]{addInHeaderInfo}{
name, type, namespace\optional{, element_type\optional{, mustUnderstand}}
}
Similar to \method{addInParameter()}, this method may be called to define an
input SOAP header associated with a service operation. The arguments
are the same except that the \var{namespace} is required for headers and
you may pass an optional true value for \var{mustUnderstand} to indicate
that support for the header is required.
\end{methoddesc}
\begin{methoddesc}[SOAPCallInfo]{addOutHeaderInfo}{
name, type, namespace\optional{, element_type\optional{, mustUnderstand}}
}
The same as \method{addInHeaderInfo()}, but defines an output
SOAP header associated with a service operation.
\end{methoddesc}
\begin{methoddesc}[SOAPCallInfo]{getInParameters}{}
Return a sequence of \class{ParameterInfo} instances representing the
input parameters of the operation.
\end{methoddesc}
\begin{methoddesc}[SOAPCallInfo]{getOutParameters}{}
Return a sequence of \class{ParameterInfo} instances representing the
output parameters of the operation.
\end{methoddesc}
\begin{methoddesc}[SOAPCallInfo]{getReturnParameter}{}
Return a \class{ParameterInfo} instance representing the \code{return}
parameter of the operation. Note that it possible for SOAP operations to
not define a return value, in which case this returns \code{None}.
\end{methoddesc}
\begin{methoddesc}[SOAPCallInfo]{getInHeaders}{}
The same as \method{getInParameters()}, but returns a sequence of
\class{HeaderInfo} instances.
\end{methoddesc}
\begin{methoddesc}[SOAPCallInfo]{getOutHeaders}{}
The same as \method{getOutParameters()}, but returns a sequence of
\class{HeaderInfo} instances.
\end{methoddesc}
\subsection{ParameterInfo Objects}
A \class{ParameterInfo} object describes a parameter to a web service
operation.
\begin{memberdesc}{name}
The name of the parameter.
\end{memberdesc}
\begin{memberdesc}{type}
A QName tuple of the form \code{(namespaceURI, typeName)} that indicates an
XSD simpleType, complexType or element associated with the parameter.
\end{memberdesc}
\begin{memberdesc}{element_type}
A boolean value that indicates whether the \code{type} attribute of the
parameter is a reference to an XSD element rather than a simpleType or
complexType. The default for this attribute is 0.
\end{memberdesc}
\begin{memberdesc}{namespace}
A namespace URI that is associated with the parameter. The default for
this attribute is \code{None}.
\end{memberdesc}
\subsection{HeaderInfo Objects}
A \class{HeaderInfo} object is similar to a \class{ParameterInfo} object,
but describes a SOAP header associated with a web service operation.
The members of \class{HeaderInfo} objects are the same as those of
\class{ParameterInfo}, except that the \code{namespace} attribute must
have a non-null value and there is an added \member{mustUnderstand}
attribute indicating whether or not the header is a ``must understand''
SOAP header.
\subsection{SOAPCallInfo Example}
This example demonstrates using a \class{SOAPCallInfo} object loaded from
WSDL to print out calling information for the methods defined by the WSDL.
\begin{verbatim}
from WebService.SOAPCallInfo import callInfoFromWSDL
from WebService.WSDLTools import WSDLReader
wsdl = WSDLReader.loadFromURL('http://www.mssoapinterop.org/asmx/typed.asmx?WSDL')
service = wsdl.services[0]
port = service.ports[0]
binding = port.getBinding()
for item in binding.getOperations():
callinfo = callInfoFromWSDL(port, item.name)
print 'Method ' + callinfo.methodName + ' takes arguments: ',
for param in callinfo.getInParameters():
print param.name + ' ',
print
\end{verbatim}
=== Added File Packages/WebService/doc/SOAPMessage.tex ===
\section{\module{WebService.SOAPMessage}}
\declaremodule{}{WebService.SOAPMessage}
The \module{SOAPMessage} module provides a high-level interface for
working with SOAP messages. The \class{SOAPMessage} model provides a
layer of abstraction that simplifies client and server applications
by taking care of most of the details of SOAP message serialization.
At the same time, \class{SOAPMessage} objects still providing a good
deal of control and convenient ways to customize message processing.
\begin{classdesc}{SOAPMessage}{\optional{, message_body}}
The \class{SOAPMessage} class represents a single SOAP message. It
can be used by both clients and servers, both to build new request
or response messages or to interpret a recieved message.
The message may be instantiated with a \var{message_body} in order to
deserialize and work with a recieved message (such as a request recieved
from a client or a response recieved from a server). The \var{message_body}
should be a string containing the body of the message. The message body may
be XML text or the body of a MIME multipart message.
If the \var{message_body} is not specified, then the message object is used
to build and serialize a new SOAP message (such as a request to a server
or a response to a client). In this case, you will use the APIs of the
\class{SOAPMessage} to populate and serialize the new message.
\end{classdesc}
\begin{excdesc}{InvalidMessage}
This exception is raised when errors occur in the parsing or
building of SOAP messages, usually indicating invalid usage or
message input.
\end{excdesc}
\subsection{SOAPMessage Objects}
\begin{memberdesc}{serializer}
The \class{Serializer} instance that will be used to perform data
serialization and deserialization for this message. The default
serializer for \class{SOAPMessage} objects supports the standard
SOAP and XML Schema simple types.
You should not load schema into the default serializer. To support
custom types, set this attribute to a different \class{Serializer}
instance loaded with the appropriate schema.
\end{memberdesc}
\begin{memberdesc}{soapAction}
The SOAP action associated with the message, or \code{None} if undefined.
\end{memberdesc}
\begin{memberdesc}{methodName}
The method name that will be used in the SOAP RPC struct for RPC-style
messages. This value must be set before an RPC-style message can be
serialized. This attribute is not used for document-style messages.
\end{memberdesc}
\begin{memberdesc}{namespace}
The namespace URI value to use for the SOAP RPC struct for RPC-style
messages. A namespace value must be set before an RPC-style message
can be serialized. This attribute is not used for document-style
messages.
\end{memberdesc}
\begin{memberdesc}{version}
The SOAP protocol version to use for this message (the default is
\code{1.1}. For new messages, this should be set before the
\method{serialize()} method is called to have an effect.
If the message is loaded from an existing message body, this attribute will
reflect the protocol version of the message after the \method{deserialize()}
method is called.
\end{memberdesc}
\begin{memberdesc}{style}
A string value indicating the SOAP message style. Valid values are
\code{'document'} and \code{'rpc'}. The default is \code{'rpc'}.
\end{memberdesc}
\begin{methoddesc}[SOAPMessage]{getContentType}{}
Return the content type of the serialized message body. For
\class{SOAPMessage} instances that are not initialized with a message
body, the content type is not available until after the
\method{serialize()} method is called.
The value returned is suitable for sending as the Content-Type header
value when sending the message over transports that support MIME
headers.
\end{methoddesc}
\begin{methoddesc}[SOAPMessage]{getMessageBody}{}
Return the serialized XML or MIME body of the message, or \code{None}
if the message body is not yet available. Note that for \class{SOAPMessage}
instances that are not initialized with a message body, the message body
is not available until after the \method{serialize()} method is called.
\end{methoddesc}
\begin{methoddesc}[SOAPMessage]{getMimeParts}{}
Return a sequence containing \class{MIMEPart} instances representing
any MIME parts associated with the message. Note that the MIME parts of
a message are not available until the message has been deserialized.
\end{methoddesc}
\begin{methoddesc}[SOAPMessage]{getMimePart}{name}
Return the named MIME part associated with the message, or \code{None}
if the named part is not found.
\end{methoddesc}
\begin{methoddesc}[SOAPMessage]{getSOAPHeaders}{}
Return a sequence containing \class{SOAPHeader} instances representing
the SOAP headers that appear in the message. The SOAP headers are not
available until the message has been deserialized.
\end{methoddesc}
\begin{methoddesc}[SOAPMessage]{getSOAPHeader}{name}
Return the named SOAP header associated with the message, or \code{None}
if the named header is not found.
\end{methoddesc}
\begin{methoddesc}[SOAPMessage]{addSOAPHeader}{name, namespace, value, type
\optional{, actor\optional{, mustUnderstand}}
}
Add a SOAP header with the given \var{name}, \var{namespace}, \var{value}
and \var{type} to the message. The \var{type} should be a QName tuple of
the form \code{(namespaceURI, typeName)}. If the \var{actor} or
\var{mustUnderstand} attributes are specified, the corresponding header
attributes will appear in the SOAP message.
\end{methoddesc}
\begin{methoddesc}[SOAPMessage]{getMustUnderstandHeaders}{}
Return a sequence of those headers in the SOAP message with true values
for their SOAP 'mustUnderstand' attributes.
\end{methoddesc}
\begin{methoddesc}[SOAPMessage]{getHeadersForActor}{actorURI}
Return a sequence of those headers in the SOAP message whose actor
attributes match the given \var{actorURI}.
\end{methoddesc}
\begin{methoddesc}[SOAPMessage]{getParameters}{}
Return a sequence of the parameters in the SOAP message. The members of
the sequence will be either \class{Parameter} or \class{MIMEPart} objects.
For RPC-style SOAP messages, the parameters represent the elements of
the RPC struct of the message. For document-style messages, they
represent the immediate child elements found in the SOAP body. Note that
the parameters are not available until the message has been deserialized.
\end{methoddesc}
\begin{methoddesc}[SOAPMessage]{getParameter}{name}
Return the named parameter of the message, or \code{None} if the named
parameter is not found. The return value will be either a \class{Parameter}
or \class{MIMEPart} object.
\end{methoddesc}
\begin{methoddesc}[SOAPMessage]{getReturnValue}{}
Return the *value* of the first parameter that appears in the message
(which represents the 'return' value in a reply from a service). This
method will return code{None} if the message contains no parameters.
\end{methoddesc}
\begin{methoddesc}[SOAPMessage]{addParameter}{
name, value, type\optional{, namespace}
}
Add a parameter with the given values to the message. The \var{type}
should be a QName tuple of the form \code{(namespaceURI, typeName)}.
The \var{namespace} should only be passed when adding parameters to
a SOAP document-style message. Note that parameters are serialized in
the order that they are added to the message.
\end{methoddesc}
\begin{methoddesc}[SOAPMessage]{addMimeParam}{
name, content_type, data
}
Add a \class{MIMEPart} parameter to the message with the given \var{name},
\var{content_type} and \var{data}. The \var{data} may be either a string
or a file-like object containing the MIME data. Note that adding a MIME
parameter to a message will cause it to be serialized as a
MIME \code{multipart/related} message.
\end{methoddesc}
\begin{methoddesc}[SOAPMessage]{getFault}{}
Return the fault associated with the SOAP message as a \class{SOAPFault}
instance, or \code{None} if no fault is present in the message. Note that
fault information is not available until the message has been deserialized.
\end{methoddesc}
\begin{methoddesc}[SOAPMessage]{isFault}{}
Return a true value if the SOAP message contains a fault.
\end{methoddesc}
\begin{methoddesc}[SOAPMessage]{serialize}{}
Serialize the message data into a valid XML or MIME string. After the
\method{serialize()} method has been called, the serialized message is
available as the \code{XXX} attribute of the \class{SOAPMessage}.
This method will call the \method{beforeSerialize()} before beginning
serialization and \method{afterSerialize()} afterward, making it easy
for subclasses to provide custom message processing.
\end{methoddesc}
\begin{methoddesc}[SOAPMessage]{deserialize}{}
Deserialize the message, making parameter and other data available. This
should only be called on instances initialized from existing SOAP message
data.
This method will call the \method{beforeDeserialize()} before beginning
deserialization and \method{afterDeserialize()} afterward, making it easy
for subclasses to provide custom message processing.
\end{methoddesc}
\begin{methoddesc}[SOAPMessage]{beforeSerialize}{}
This method is called before serialization starts. Derived classes can
implement this method to customize message processing.
\end{methoddesc}
\begin{methoddesc}[SOAPMessage]{afterSerialize}{}
This method is called after serialization is complete. Derived classes
can implement this method to customize message processing.
\end{methoddesc}
\begin{methoddesc}[SOAPMessage]{beforeDeserialize}{}
This method is called before deserialization starts. Derived classes can
implement this method to customize message processing.
\end{methoddesc}
\begin{methoddesc}[SOAPMessage]{afterDeserialize}{}
This method is called after deserialization is complete. Derived classes
can implement this method to customize message processing.
\end{methoddesc}
\subsection{SOAPMessage Examples}
This example uses a \class{SOAPMessage} object to build a SOAP request,
sends it to the remote service using an \class{HTTPTransport} and uses
another \class{SOAPMessage} instance to interpret the response.
\begin{verbatim}
from WebService.SOAPMessage import SOAPMessage
from WebService.Transports import HTTPTransport
# Build the outgoing SOAP request message.
message = SOAPMessage()
message.soapAction = 'urn:xmethodsBabelFish#BabelFish'
message.methodName = 'BabelFish'
message.namespace = 'urn:xmethodsBabelFish'
message.addParameter('translationmode', 'en_de', (DOM.NS_XSD, 'string'))
message.addParameter('sourcedata', 'This is a test!', (DOM.NS_XSD, 'string'))
message.serialize()
# Send the message to the remote web service.
transport = HTTPTransport()
response = transport.send(
'http://services.xmethods.net:80/perl/soaplite.cgi',
'urn:xmethodsBabelFish#BabelFish',
message.getMessageBody(),
message.getContentType()
)
# Create a new SOAPMessage for the response.
reply_msg = SOAPMessage(response.body)
reply_msg.deserialize()
result = reply_msg.getReturnValue()
\end{verbatim}
=== Added File Packages/WebService/doc/SOAPReader.tex ===
\section{\module{WebService.SOAPReader}}
\declaremodule{}{WebService.SOAPReader}
The \module{SOAPReader} module provides a relatively simple interface for
working with the low-level DOM structures of a SOAP XML message.
\begin{classdesc}{SOAPReader}{xmldata}
The \class{SOAPReader} class provides methods to simplify traversal of
the element structure of a SOAP XML message. It provides quick access to
the main structures of a message like the envelope, headers and fault
information that would otherwise require a lot of tedious DOM code.
The \var{xmldata} argument is either a string or a file-like object
containing the XML data of a SOAP message.
\end{classdesc}
\subsection{SOAPReader Objects}
\begin{memberdesc}{document}
The DOM document object that underlies the \class{SOAPReader}. You can
use this to work with the DOM document directly if needed. Note that due
to cleanup issues the lifetime of the \code{document} is bound to that of
the \class{SOAPReader}.
\end{memberdesc}
\begin{memberdesc}{version}
A string indicating the SOAP protocol version of the message (such as
\code{'1.1'}).
\end{memberdesc}
\begin{memberdesc}{NS_SOAP_ENV}
The value of the SOAP envelope namespace corresponding to the SOAP
protocol version of the message.
\end{memberdesc}
\begin{memberdesc}{NS_SOAP_ENC}
The value of the SOAP encoding namespace corresponding to the SOAP
protocol version of the message.
\end{memberdesc}
\begin{methoddesc}[SOAPReader]{getEnvelope}{}
Return the SOAP envelope element of the message as a DOM \class{Element}.
\end{methoddesc}
\begin{methoddesc}[SOAPReader]{getHeader}{}
Return the SOAP header element of the message as a DOM \class{Element},
or \code{None} if the message does not contain a header.
\end{methoddesc}
\begin{methoddesc}[SOAPReader]{getHeaderElements}{}
Return a sequence of the child attributes of the SOAP header element.
\end{methoddesc}
\begin{methoddesc}[SOAPReader]{getMustUnderstandHeaders}{}
Return a sequence of the child elements of the SOAP header element that
have true mustUnderstand attributes.
\end{methoddesc}
\begin{methoddesc}[SOAPReader]{getHeaderElement}{name\optional{, namespaceURI}}
Return the SOAP header entry element with the given \var{name} and
optional \var{namespaceURI}.
\end{methoddesc}
\begin{methoddesc}[SOAPReader]{getBody}{}
Return the SOAP body element of the message as a DOM \class{Element}.
\end{methoddesc}
\begin{methoddesc}[SOAPReader]{getBodyElements}{}
Return a sequence of the child elements of the SOAP body element.
\end{methoddesc}
\begin{methoddesc}[SOAPReader]{getBodyElement}{name\optional{, namespaceURI}}
Return the SOAP body entry element with the given \var{name} and optional
\var{namespaceURI}.
\end{methoddesc}
\begin{methoddesc}[SOAPReader]{getRPCStruct}{}
Return the RPC struct element of the SOAP message (first child of the
SOAP body element), or \code{None} if the body has no child elements.
\end{methoddesc}
\begin{methoddesc}[SOAPReader]{getRPCParams}{}
Return a sequence of the child elements of the RPC struct of the SOAP
message. The return value may be an empty sequence if the RPC struct
has no child elements.
\end{methoddesc}
\begin{methoddesc}[SOAPReader]{getRPCParam}{name\optional{, namespaceURI}}
Return the RPC parameter element matching the given \var{name} and
optional \var{namespaceURI}.
\end{methoddesc}
\begin{methoddesc}[SOAPReader]{getRPCResult}{}
Return the first child element of the RPC struct of the SOAP message, or
\code{None} if the RPC struct has no child elements.
\end{methoddesc}
\begin{methoddesc}[SOAPReader]{getElementByRef}{reference}
Return the element indicated by the given element href \var{reference}.
\end{methoddesc}
\begin{methoddesc}[SOAPReader]{getElementById}{element_id}
Return the element indicated by the given element id.
\end{methoddesc}
\begin{methoddesc}[SOAPReader]{derefElement}{element}
Dereference the given \var{element} returning the target element of any
\code{href} attribute of the element. If \var{element} does not have an
\code{href} attribute, the input element is returned.
\end{methoddesc}
\begin{methoddesc}[SOAPReader]{getEncodingStyle}{element}
Return the active encoding style in the context of the given \var{element}.
\end{methoddesc}
\begin{methoddesc}[SOAPReader]{isFaultMessage}{}
Return true if the SOAP message contains a fault.
\end{methoddesc}
\begin{methoddesc}[SOAPReader]{getFault}{}
Return the SOAP fault element of the message as a DOM \class{Element},
or \code{None} if the message does not contain a fault.
\end{methoddesc}
\begin{methoddesc}[SOAPReader]{getFaultString}{}
Return the *value* of the SOAP faultstring sub-element of the fault
element, or \code{None} if the message does not contain a fault.
\end{methoddesc}
\begin{methoddesc}[SOAPReader]{getFaultCode}{}
Return the *value* of the SOAP faultcode sub-element of the fault
element (not including any namespace URI prefix), or \code{None} if
the message does not contain it.
\end{methoddesc}
\begin{methoddesc}[SOAPReader]{getFaultCodeNS}{}
Return the *value* of the namespace URI of the SOAP faultcode sub-element
of the fault element, or \code{None} if the message does not contain it.
\end{methoddesc}
\begin{methoddesc}[SOAPReader]{getFaultActor}{}
Return the *value* of the SOAP faultactor sub-element of the fault
element, or \code{None} if the message does not contain it.
\end{methoddesc}
\begin{methoddesc}[SOAPReader]{getFaultDetail}{}
Return the detail sub-element of the fault element, or \code{None} if the
message does not contain it.
\end{methoddesc}
\subsection{SOAPReader Example}
This example uses a SOAPReader object to read a SOAP message and
print the number of RPC parameters it contains.
\begin{verbatim}
from WebService.SOAPReader import SOAPReader
from WebService.Utility import DOM
xmldata = '''<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<m:SomeMethodName xmlns:m="Some-URI">
<param1 xsi:type=''xsd:int''>1</param1>
<param2 xsi:type=''xsd:int''>2</param2>
<param3 xsi:type=''xsd:int''>3</param3>
</m:SomeMethodName>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>'''
reader = SOAPReader(xmldata)
params = reader.getRPCParams()
print 'The number of parameters is ' + str(len(params))
\end{verbatim}
=== Added File Packages/WebService/doc/SOAPWriter.tex ===
\section{\module{WebService.SOAPWriter}}
\declaremodule{}{WebService.SOAPWriter}
The \module{SOAPWriter} module provides a simplified interface for writing
SOAP XML messages.
\begin{classdesc}{SOAPWriter}{\optional{, version\optional{, encoding}}}
The \class{SOAPWriter} class is a specialized \class{XMLWriter} that
provides convenience methods for writing the major structures of a
SOAP message.
The optional \var{version} indicates the SOAP protocol version of the
message (which affects the namespaces to be used). The version must be a
string indicating a supported SOAP version. The default is '1.1'.
If the optional \var{encoding} is specified, that encoding will be used
for the resulting XML document. The default encoding is \code{UTF-8}.
\end{classdesc}
\subsection{SOAPWriter Objects}
\class{SOAPWriter} objects extend the \class{XMLWriter} interface with
methods that simplify the process of writing SOAP XML messages. In
particular, the \class{SOAPWriter} interface makes it easy to write
non-linear constructs, such as RPC parameters that reference data that
is actually located in ``trailer'' elements (elements that follow the
SOAP body part of the message).
For example, you can call \method{startElement()} to begin an RPC
parameter element, then call \method{startTrailerElement()} to write the
data element that the RPC element refers to. The trailer element started
with \method{startTrailerElement()} will be become the active element
until it is ended, at which point the original RPC element will once
again be the active element.
\class{SOAPWriter} objects support the following attributes and
methods in addition to those inherited from \class{XMLWriter}.
\begin{memberdesc}{NS_SOAP_ENV}
The value of the SOAP envelope namespace to be used for this message,
based on the \code{version} passed in the constructor.
\end{memberdesc}
\begin{memberdesc}{NS_SOAP_ENC}
The value of the SOAP encoding namespace to be used for this message,
based on the \code{version} passed in the constructor.
\end{memberdesc}
\begin{memberdesc}{version}
A string representing the SOAP protocol version of this message. This
attribute should be considered read-only. It reflects the protocol
version passed in the constructor (or the default version if none was
given). The default version is '1.1'.
\end{memberdesc}
\begin{methoddesc}[SOAPWriter]{startEnvelope}{\optional{, encodingStyle}}
Begin the SOAP envelope element of the message. If the optional
\var{encodingStyle} (string) is specified, that value will be written as the
encodingStyle attribute of the element.
\end{methoddesc}
\begin{methoddesc}[SOAPWriter]{endEnvelope}{}
End the SOAP envelope element of the message.
\end{methoddesc}
\begin{methoddesc}[SOAPWriter]{startHeader}{\optional{, encodingStyle}}
Begin the SOAP header element of the message. If the optional
\var{encodingStyle} (string) is specified, that value will be written as the
encodingStyle attribute of the element.
\end{methoddesc}
\begin{methoddesc}[SOAPWriter]{endHeader}{}
End the SOAP header element of the message.
\end{methoddesc}
\begin{methoddesc}[SOAPWriter]{startHeaderElement}{
name, namespaceURI, \optional{, mustUnderstand\optional{, actor}}
}
Begin a header entry element in the SOAP header of the message with the
given \var{name} and \var{namespaceURI}. If the optional \var{mustUnderstand}
or \var{actor} are specified, the corresponding attributes will be written
to the header entry element.
\end{methoddesc}
\begin{methoddesc}[SOAPWriter]{endHeaderElement}{}
End the last started header entry element.
\end{methoddesc}
\begin{methoddesc}[SOAPWriter]{startBody}{\optional{, encodingStyle}}
Begin the SOAP body element of the message. If the optional
\var{encodingStyle} (string) is specified, that value will be written as the
encodingStyle attribute of the element.
\end{methoddesc}
\begin{methoddesc}[SOAPWriter]{endBody}{}
End the SOAP body element of the message.
\end{methoddesc}
\begin{methoddesc}[SOAPWriter]{startBodyElement}{
name, \optional{, namespaceURI}
}
Begin a new child element of the SOAP body element of the message.
\end{methoddesc}
\begin{methoddesc}[SOAPWriter]{endBodyElement}{}
End the last started body element.
\end{methoddesc}
\begin{methoddesc}[SOAPWriter]{startTrailerElement}{
name, \optional{, namespaceURI}
}
Begin a new child element of the SOAP envelope that appears *after* the
body element of the message.
\end{methoddesc}
\begin{methoddesc}[SOAPWriter]{endTrailerElement}{}
End the last started trailer element.
\end{methoddesc}
\begin{methoddesc}[SOAPWriter]{startFault}{
faultcode, faultstring, \optional{, faultactor\optional{,
faultcodeNS}}
}
Start the SOAP fault element of the message. The SOAP body element must
have been started before calling this method, and the body should contain
no other elements.
The \var{faultcode} should be a string fault identifier as defined by
the SOAP specification. The \var{faultcode} should *not* be namespace
prefixed - the writer will automatically add the appropriate prefix
(either the SOAP envelope namespace or \var{faultcodeNS}, if given).
The \var{faultstring} and optional \var{faultactor} provide a short
error message and information about the source of the fault.
\end{methoddesc}
\begin{methoddesc}[SOAPWriter]{endFault}{}
End the SOAP fault element of the message.
\end{methoddesc}
\begin{methoddesc}[SOAPWriter]{startFaultDetail}{}
Begin the fault detail element of the message. This must be called between
\method{startFault()} and \method{endFault()}.
\end{methoddesc}
\begin{methoddesc}[SOAPWriter]{endFaultDetail}{}
End the fault detail element of the message.
\end{methoddesc}
\begin{methoddesc}[SOAPWriter]{writeEncodingStyle}{encodingStyle}
Write a SOAP encodingStyle attribute to the current element with the
given string value.
\end{methoddesc}
\subsection{SOAPWriter Example}
This example uses a SOAPWriter object to produce a simple SOAP message.
\begin{verbatim}
from WebService.SOAPWriter import SOAPWriter
from WebService.Utility import DOM
writer = SOAPWriter()
writer.startEnvelope(encodingStyle=writer.NS_SOAP_ENC)
writer.startBody()
# Write the RPC struct element.
writer.startElement('BabelFish', 'urn:xmethodsBabelFish')
# Write the parameter elements.
typestr = writer.makeQName(DOM.NS_XSD, 'string')
writer.startElement('translationmode')
writer.writeAttr('type', typestr, DOM.NS_XSI)
writer.writeText('en_de')
writer.endElement()
writer.startElement('sourcedata')
writer.writeAttr('type', typestr, DOM.NS_XSI)
writer.writeText('This is a test!')
writer.endElement()
# End the RPC struct element.
writer.endElement()
writer.endBody()
writer.endEnvelope()
xml = writer.toString(1)
\end{verbatim}
In this example, printing the \code{xml} variable would produce:
\begin{verbatim}
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns0="urn:xmethodsBabelFish"
xmlns:ns1="http://www.w3.org/2001/XMLSchema"
xmlns:ns2="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ns0:BabelFish>
<translationmode ns2:type="ns1:string">
en_de
</translationmode>
<sourcedata ns2:type="ns1:string">
This is a test!
</sourcedata>
</ns0:BabelFish>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
\end{verbatim}
=== Added File Packages/WebService/doc/ServiceProxy.tex ===
\section{\module{WebService.ServiceProxy}}
\declaremodule{}{WebService.ServiceProxy}
The \module{ServiceProxy} module provides a convenient way to call
remote web services that are described with WSDL. Service proxies
expose methods that reflect the methods of the remote web service.
\begin{classdesc}{ServiceProxy}{wsdl,\optional{, service\optional{, port}}}
The \class{ServiceProxy} class provides a high-level Pythonic way to
call remote web services. A WSDL description must be available for the
remote service.
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.
\end{classdesc}
\subsection{ServiceProxy Objects}
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).
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.
\subsection{ServiceProxy Example}
This example demonstrates instantiating a \class{ServiceProxy} object
from a WSDL description to call a remote web service method.
\begin{verbatim}
from WebService.ServiceProxy import ServiceProxy
service = ServiceProxy('http://www.xmethods.net/sd/BabelFishService.wsdl')
value = service.BabelFish('en_de', 'This is a test!')
\end{verbatim}
=== Added File Packages/WebService/doc/Transports.tex ===
\section{\module{WebService.Transports}}
\declaremodule{}{WebService.Transports}
The \module{Transports} module defines objects that can be used to send
and recieve SOAP messages over HTTP and SMTP. The transport objects defined
here allow applications to specify timeout limits, which provides some
control over the impact of potentially blocking SOAP calls.
\begin{classdesc}{HTTPTransport}{\optional{timeout}}
An \class{HTTPTransport} is used to send SOAP messages over the HTTP
protocol. An integer \var{timeout}, in seconds, may be given to limit
the amount of time a connection attempt can block the application.
The \class{HTTPTransport} can also be used to communicate with secure
servers using HTTPS if the Python installation supports SSL. Note that
Python does not have SSL support enabled by default. See the Python
documentation for details on enabling SSL support.
\end{classdesc}
\begin{classdesc}{SMTPTransport}{smtphost, fromaddr, subject,
\optional{timeout}
}
The \class{SMTPTransport} is an experimental transport used to send SOAP
messages over SMTP. Note that the SOAP specification does not define an
official mapping of SOAP to SMTP - the current implementation simply
sends SOAP messages as mail messages and includes the SOAPAction value
as a MIME header.
The \var{smtphost} and \var{fromaddr} specify the SMTP host and \emph{from}
address to use in messages sent using the transport. The \var{subject} gives
the subject line that will be used. Like the HTTP transport, a \var{timeout}
may be specified to control connection blocking.
\end{classdesc}
\begin{excdesc}{TimeoutError}
This exception is raised when network communications time out.
\end{excdesc}
\subsection{HTTPTransport Objects}
\begin{memberdesc}{followRedirects}
This is a boolean attribute that determines whether the transport will
attempt to automatically follow HTTP redirects. The default is to follow
redirects (throwing an exception if a circular redirect is detected).
\end{memberdesc}
\begin{memberdesc}{userAgent}
The string that the transport will send for the HTTP User-Agent header.
This may be changed to customize the apparent user agent.
\end{memberdesc}
\begin{memberdesc}{timeout}
The socket timeout for the transport, in seconds.
\end{memberdesc}
\begin{methoddesc}[HTTPTransport]{send}{address, soapAction, message
\optional{, contentType\optional{, headers}}
}
Send a SOAP message over HTTP or HTTPS (depending on the \var{address}
URL). The \var{soapAction} should be the value to send for the SOAPAction
header, and \var{message} should be the SOAP message string to send. The
optional \var{contentType} indicates the content type of the message (which
defaults to \code{'text/xml'}. An optional \var{headers} mapping may be
specified, containing extra HTTP headers to be sent with the message.
This method returns an class{HTTPResponse} instance containing the response
information, unless a server error occurs. An \class{HTTPResponse} will be
raised as an exception for any non-2xx response that does not include a
\code{text/xml} message body.
\end{methoddesc}
\subsection{HTTPResponse Objects}
\class{HTTPResponse} objects capture the server response to an HTTP request.
\begin{memberdesc}{status}
The integer status code returned from the server.
\end{memberdesc}
\begin{memberdesc}{reason}
The text status message returned from the server.
\end{memberdesc}
\begin{memberdesc}{headers}
An \class{mimetools.Message} instance that provides access to the HTTP
headers returned by the server.
\end{memberdesc}
\begin{memberdesc}{body}
The body of the server response, or None if there was no response body.
\end{memberdesc}
\subsection{SMTPTransport Objects}
\begin{memberdesc}{smtphost}
The SMTP server to be used to send messages.
\end{memberdesc}
\begin{memberdesc}{fromaddr}
The emph{from} address to use when sending messages.
\end{memberdesc}
\begin{memberdesc}{subject}
The subject line to use when sending messages.
\end{memberdesc}
\begin{memberdesc}{timeout}
The socket timeout for the transport, in seconds.
\end{memberdesc}
\begin{methoddesc}[SMTPTransport]{send}{address, soapAction, message
\optional{, contentType\optional{, headers}}
}
Send a SOAP message using SMTP to the given email \var{address}. The
given \var{soapAction} is sent as the value of a \code{SOAPAction} MIME
header with the message. The \var{message} should be the SOAP message string
to be sent. The optional \var{contentType} indicates the content type of the
message (which defaults to \code{'text/xml'}. An optional \var{headers}
mapping may be specified, containing extra MIME headers to be sent with the
message.
Since SMTP messaging is inherently one-way, this method returns None.
\end{methoddesc}
=== Added File Packages/WebService/doc/Utility.tex ===
\section{The \module{Utility} Module}
\declaremodule{}{Utility}
The \module{Utility} module provides utilities and constants used by the
rest of the web services package.
\subsection{The DOM Object}
Much of the web services package is built on the document object model
(DOM). The DOM object defined by the \module{Utility} package is a
singleton that encapsulates a number of useful DOM functions and
constants (such as XML namespaces used by the various web services
technologies).
The DOM singleton provides interfaces for creating, loading and working
with XML documents using the DOM api without having to worry too much
about of the actual DOM implementation in use. The web services package
currently uses the built-in Python \module{minidom} module, which is
good enough for most tasks and doesn't require additional software to
be added to a standard Python 2.x installation.
This section documents the most important general-use attributes and
methods of the DOM singleton (see the source for more esoteric things).
\begin{methoddesc}[DOM]{createDocument}{namespaceURI, qualifiedName}
Return a new DOM document object, with the given values for the root element.
\end{methoddesc}
\begin{methoddesc}[DOM]{loadDocument}{file}
Return a DOM document object loaded from the given file-like object.
\end{methoddesc}
\begin{methoddesc}[DOM]{loadFromURL}{url}
Return a DOM document object loaded from the given URL.
\end{methoddesc}
\begin{methoddesc}[DOM]{isElement}{node, name\optional{, namespaceURI}}
Return true if the given DOM \var{node} is an element node matching the
given \var{name} and \var{namespaceURI}.
\end{methoddesc}
\begin{methoddesc}[DOM]{getElement}{
node, name\optional{, namespaceURI\optional{, default}}
}
Return a child element of the given DOM \var{node} matching the given
\var{name} and \var{namespaceURI}, or the \var{default} if given. If no
default is given and a matching element is not found, a \exception{KeyError}
is raised.
\end{methoddesc}
\begin{methoddesc}[DOM]{getElements}{
node, name\optional{, namespaceURI}
}
Return a sequence of the child elements of the given DOM \var{node} matching
the given \var{name} and \var{namespaceURI}.
\end{methoddesc}
\begin{methoddesc}[DOM]{getElementById}{node, id\optional{, default}}
Return a child element of the given \var{node} that has an ``id'' attribute
matching the given \var{id}, or the \var{default} if given. If no
default is given and a matching element is not found, a \exception{KeyError}
is raised.
\end{methoddesc}
\begin{methoddesc}[DOM]{getAttr}{
element, name\optional{, namespaceURI\optional{, default}}
}
Return the value of the attribute of \var{element} with the given \var{name}
and optional \var{namespaceURI} or the \var{default} if given. If no
default is given and a matching attribute is not found, an empty string is
returned.
\end{methoddesc}
\begin{methoddesc}[DOM]{hasAttr}{
element, name\optional{, namespaceURI}
}
Return true if \var{element} has an attribute with the given \var{name}
and optional \var{namespaceURI}.
\end{methoddesc}
\begin{methoddesc}[DOM]{getElementText}{element\optional{, preserveWS}}
Return the text value of a DOM element. Leading and trailing whitespace is
stripped unless \var{preserveWS} is a true value.
\end{methoddesc}
\begin{methoddesc}[DOM]{elementToString}{element\optional{, format}}
Return a XML string representation of \var{element}. If \var{format} is
true, the string will be formatted for readability.
\end{methoddesc}
\begin{memberdesc}{NS_SOAP_ENV_ALL}
A sequence that contains all of the supported SOAP envelope namespaces.
\end{memberdesc}
\begin{memberdesc}{NS_SOAP_ENC_ALL}
A sequence that contains all of the supported SOAP encoding namespaces.
\end{memberdesc}
\begin{memberdesc}{NS_SOAP_ENV}
The value of the default SOAP envelope namespace (currently the SOAP 1.1
envelope namespace).
\end{memberdesc}
\begin{memberdesc}{NS_SOAP_ENC}
The value of the default SOAP encoding namespace (currently the SOAP 1.1
encoding namespace).
\end{memberdesc}
\begin{methoddesc}[DOM]{SOAPUriToVersion}{uri}
Returns the SOAP version string related to the given SOAP envelope uri.
\end{methoddesc}
\begin{methoddesc}[DOM]{GetSOAPEnvUri}{version}
Return the appropriate SOAP envelope uri for a given SOAP version.
\end{methoddesc}
\begin{methoddesc}[DOM]{GetSOAPEncUri}{version}
Return the appropriate SOAP encoding uri for a given SOAP version.
\end{methoddesc}
\begin{methoddesc}[DOM]{GetSOAPActorNextUri}{version}
Return the appropriate SOAP ``next actor'' uri for a given SOAP version.
\end{methoddesc}
\begin{memberdesc}{NS_XSD_ALL}
A sequence that contains all of the supported XML Schema namespaces.
\end{memberdesc}
\begin{memberdesc}{NS_XSI_ALL}
A sequence that contains all of the supported XML Schema instance namespaces.
\end{memberdesc}
\begin{memberdesc}{NS_XSD}
The value of the default XML Schema namespace (currently the
XML Schema 2001 namespace).
\end{memberdesc}
\begin{memberdesc}{NS_XSI}
The value of the default XML Schema instance namespace
(currently the XML Schema 2001 instance namespace).
\end{memberdesc}
\begin{memberdesc}{NS_XSD_99}
The value of the 1999 XML Schema namespace.
\end{memberdesc}
\begin{memberdesc}{NS_XSI_99}
The value of the 1999 XML Schema instance namespace.
\end{memberdesc}
\begin{memberdesc}{NS_XSD_00}
The value of the 2000 XML Schema namespace.
\end{memberdesc}
\begin{memberdesc}{NS_XSI_00}
The value of the 2000 XML Schema instance namespace.
\end{memberdesc}
\begin{memberdesc}{NS_XSD_01}
The value of the 2001 XML Schema namespace.
\end{memberdesc}
\begin{memberdesc}{NS_XSI_01}
The value of the 2001 XML Schema instance namespace.
\end{memberdesc}
\begin{methoddesc}[DOM]{InstanceUriForSchemaUri}{uri}
Returns the appropriate matching XML Schema instance URI for the given
XML Schema namspace URI, or \code{None} if no match is found.
\end{methoddesc}
\begin{methoddesc}[DOM]{SchemaUriForInstanceUri}{uri}
Returns the appropriate matching XML Schema namespace URI for the given
XML Schema instance URI, or \code{None} if no match is found.
\end{methoddesc}
\begin{memberdesc}{NS_WSDL_ALL}
A sequence that contains all of the supported WSDL namespaces.
\end{memberdesc}
\begin{memberdesc}{NS_WSDL}
The value of the default WSDL namespace (currently the WSDL 1.1 namespace).
\end{memberdesc}
\begin{methoddesc}[DOM]{WSDLUriToVersion}{uri}
Returns a version string related to the given WSDL namespace URI.
\end{methoddesc}
\begin{methoddesc}[DOM]{GetWSDLSoapBindingUri}{version}
Return an appropriate namespace URI for the given WSDL \var{version}.
\end{methoddesc}
\begin{methoddesc}[DOM]{GetWSDLHttpBindingUri}{version}
Return an appropriate namespace URI for the given WSDL \var{version}.
\end{methoddesc}
\begin{methoddesc}[DOM]{GetWSDLMimeBindingUri}{version}
Return an appropriate namespace URI for the given WSDL \var{version}.
\end{methoddesc}
\begin{methoddesc}[DOM]{GetWSDLHttpTransportUri}{version}
Return an appropriate namespace URI for the given WSDL \var{version}.
\end{methoddesc}
=== Added File Packages/WebService/doc/WSDLTools.tex === (738/838 lines abridged)
\section{\module{WebService.WSDLTools}}
\declaremodule{}{WebService.WSDLTools}
The \module{WSDLTools} module provides classes for reading and building
WSDL service descriptions. The \module{WSDLTools} module supports the
\citetitle[http://www.w3.org/TR/wsdl]{WSDL 1.1 specification}, including
document import and support for the binding types defined in the spec.
The most important classes and exceptions provided by this module are:
\begin{classdesc}{WSDLReader}{}
The \class{WSDLReader} class provides methods for loading WSDL service
descriptions from URLs or XML data. It also provides a basic mechanism
that developers can use to ensure that a service description matches the
one that was coded against.
\end{classdesc}
\begin{classdesc}{WSDLWriter}{\optional{targetNamespace}}
The \class{WSDLWriter} class provides a simplified high-level interface
for producing WSDL service descriptions. It allows you to avoid most of
details involved in using the low-level object model to produce WSDL
descriptions for common cases.
The optional \var{targetNamespace} allows you to specify the target
namespace URI of the service description document. If this is not specified,
a target namespace URI will be generated.
\end{classdesc}
\begin{classdesc}{WSDL}{\optional{targetNamespace}}
\class{WSDL} instances represent WSDL service descriptions and provide
an object model for building and working with those descriptions.
A \var{targetNamespace} may be specified for the service description. If
no \var{targetNamspace} is specified, one will be generated.
\end{classdesc}
\begin{excdesc}{WSDLError}
This exception is raised when errors occur in the parsing or building of
WSDL objects, usually indicating invalid structure or usage.
\end{excdesc}
Note that there are quite a few other classes defined in this module that
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 following sections.
\subsection{WSDLReader Objects}
[-=- -=- -=- 738 lines omitted -=- -=- -=-]
\begin{classdesc}{SoapHeaderBinding}{
message, part, use\optional{, namespace\optional{, encodingStyle}}
}
Represents a \code{<soap:header>} element.
\end{classdesc}
\begin{classdesc}{SoapHeaderFaultBinding}{
message, part, use\optional{, namespace\optional{, encodingStyle}}
}
Represents a \code{<soap:headerfault>} element.
\end{classdesc}
\begin{classdesc}{HttpBinding}{verb}
Represents a \code{<http:binding>} element.
\end{classdesc}
\begin{classdesc}{HttpAddressBinding}{location}
Represents a \code{<http:address>} element.
\end{classdesc}
\begin{classdesc}{HttpOperationBinding}{location}
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}{
\optional{part\optional{, type}}
}
Represents a \code{<mime:content>} element.
\end{classdesc}
\begin{classdesc}{MimeXmlBinding}{\optional{part}}
Represents a \code{<mime:mimeXml>} element.
\end{classdesc}
=== Added File Packages/WebService/doc/WebService.css ===
/*
* The first part of this is the standard CSS generated by LaTeX2HTML,
* with the "empty" declarations removed.
*/
/* Century Schoolbook font is very similar to Computer Modern Math: cmmi */
.math { font-family: "Century Schoolbook", serif; }
.math i { font-family: "Century Schoolbook", serif;
font-weight: bold }
.boldmath { font-family: "Century Schoolbook", serif;
font-weight: bold }
/* Implement both fixed-size and relative sizes: */
small.xtiny { font-size : xx-small }
small.tiny { font-size : x-small }
small.scriptsize { font-size : smaller }
small.footnotesize { font-size : small }
big.xlarge { font-size : large }
big.xxlarge { font-size : x-large }
big.huge { font-size : larger }
big.xhuge { font-size : xx-large }
/*
* Document-specific styles come next;
* these are added for the Python documentation.
*
* Note that the size specifications for the H* elements are because
* Netscape on Solaris otherwise doesn't get it right; they all end up
* the normal text size.
*/
body { color: #000000;
background-color: #ffffff; }
a:active { color: #ff0000; }
a:visited { color: #551a8b; }
a:link { color: #0000bb; }
h1, h2, h3, h4, h5, h6 { font-family: avantgarde, sans-serif;
font-weight: bold }
h1 { font-size: 180% }
h2 { font-size: 150% }
h3, h4 { font-size: 120% }
code, tt { font-family: monospace }
var { font-family: times, serif;
font-style: italic;
font-weight: normal }
.navigation td { background-color: #99ccff;
font-weight: bold;
font-family: avantgarde, sans-serif;
font-size: 110% }
.release-info { font-style: italic; }
.titlegraphic { vertical-align: top; }
.verbatim { color: #00008b }
.email { font-family: avantgarde, sans-serif }
.mimetype { font-family: avantgarde, sans-serif }
.newsgroup { font-family: avantgarde, sans-serif }
.url { font-family: avantgarde, sans-serif }
.file { font-family: avantgarde, sans-serif }
.tableheader { background-color: #99ccff;
font-family: avantgarde, sans-serif; }
.refcount-info { font-style: italic }
.refcount-info .value { font-weight: bold;
color: #006600 }
/*
* Some decoration for the "See also:" blocks, in part inspired by some of
* the styling on Lars Marius Garshol's XSA pages.
* (The blue in the navigation bars is #99CCFF.)
*/
.seealso { background-color: #fffaf0;
border: thin solid black;
padding: 4pt }
.seealso .heading { font-size: 110% }
/*
* Class 'availability' is used for module availability statements at
* the top of modules.
*/
.availability .platform { font-weight: bold }
=== Added File Packages/WebService/doc/WebService.html === (3536/3636 lines abridged)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Web Services for Python</title>
<META NAME="description" CONTENT="Web Services for Python">
<META NAME="keywords" CONTENT="WebService">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="STYLESHEET" href="WebService.css">
</head>
<body>
<DIV CLASS="navigation">
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><img src="../icons/blank.gif"
border="0" height="32"
alt="" width="32"></td>
<td><img src="../icons/blank.gif"
border="0" height="32"
alt="" width="32"></td>
<td><img src="../icons/blank.gif"
border="0" height="32"
alt="" width="32"></td>
<td align="center" width="100%">Web Services for Python</td>
<td><img src="../icons/blank.gif"
border="0" height="32"
alt="" width="32"></td>
<td><img src="../icons/blank.gif"
border="0" height="32"
alt="" width="32"></td>
</tr></table>
<br><hr>
</DIV>
<!--End of Navigation Panel-->
<P>
<div class="titlepage">
<center>
<h1>Web Services for Python</h1>
<p><b><font size='+2'>Brian Lloyd</font></b></p>
<p>
Brian Lloyd, <a class="url" href="http://www.zope.com">http://www.zope.com</a>
<BR>
E-mail: <span class="email">brian@zope.com</span>
<BR></p>
<p><strong>Release 1.0</strong><br>
<strong>Oct 29, 2001</strong></p>
<p>
[-=- -=- -=- 3536 lines omitted -=- -=- -=-]
</p>
<p> <a
href="http://saftsack.fs.uni-bayreuth.de/~latex2ht/">
<strong>LaTeX</strong>2<tt>HTML</tt></a> is Copyright ©
1993, 1994, 1995, 1996, 1997, <a
href="http://cbl.leeds.ac.uk/nikos/personal.html">Nikos
Drakos</a>, Computer Based Learning Unit, University of
Leeds, and Copyright © 1997, 1998, <a
href="http://www.maths.mq.edu.au/~ross/">Ross
Moore</a>, Mathematics Department, Macquarie University,
Sydney.
</p>
<p> The application of <a
href="http://saftsack.fs.uni-bayreuth.de/~latex2ht/">
<strong>LaTeX</strong>2<tt>HTML</tt></a> to the Python
documentation has been heavily tailored by Fred L. Drake,
Jr. Original navigation icons were contributed by Christopher
Petrilli.
</p>
<DIV CLASS="navigation">
<p><hr>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><img src="../icons/blank.gif"
border="0" height="32"
alt="" width="32"></td>
<td><img src="../icons/blank.gif"
border="0" height="32"
alt="" width="32"></td>
<td><img src="../icons/blank.gif"
border="0" height="32"
alt="" width="32"></td>
<td align="center" width="100%">Web Services for Python</td>
<td><img src="../icons/blank.gif"
border="0" height="32"
alt="" width="32"></td>
<td><img src="../icons/blank.gif"
border="0" height="32"
alt="" width="32"></td>
</tr></table>
<hr>
<span class="release-info">Release 1.0, documentation updated on Oct 29, 2001.</span>
</DIV>
<!--End of Navigation Panel-->
</BODY>
</HTML>
=== Added File Packages/WebService/doc/WebService.pdf === (1249/1349 lines abridged)
%PDF-1.2
3 0 obj <<
/Length 4 0 R
/Filter /FlateDecode
>>
stream
xuKKPwJ
u!MS,}DbIj Y9MΐBHVLbdU.eWȭzHP4^mk5P
g*F`x8*筴f/=ۼ碪w<7xܿ7jAK( fp U=՝ {[y@ {ߺF"-&xjRYok ;c`6ڋaUAdVE yJ E uqyN4D'#v"dlXvTA/}?{+k>@լQ~z-Ii G{ =.֓71O75
lendstream
endobj
4 0 obj
365
endobj
2 0 obj <<
/Type /Page
/Contents 3 0 R
/Resources 1 0 R
/MediaBox [0 0 611.998 791.997]
/Parent 9 0 R
/Annots [ 8 0 R ]
>> endobj
8 0 obj <<
/Type /Annot
/Border [0 0 0]
/Rect [457.589 93.199 539.998 103.94]
/S /URI /URI (http://www.zope.com)
>> endobj
1 0 obj <<
/Font << /F26 5 0 R /F27 6 0 R /F28 5 0 R /F29 7 0 R /F30 5 0 R >>
/ProcSet [ /PDF /Text ]
>> endobj
12 0 obj <<
/Length 13 0 R
/Filter /FlateDecode
>>
stream
x}WrV}
_LL1oqٶĐ
I_}JGr#}slkx2[`||[`Mk<I$]C$nW0&CS1ӖKѨC֕zj_UCW:'IE04gknH/kߦǃݰeȶ8.ﮬwUEU-o>-βlQ5
eVuCn6As"uOհ<d"C44ӵ1&)yyIY%yvz0Bن"3?馩=fyS<i{v j\72*Gy|#yaWqE1[4M#վ`sYY:-YMհ\G#X()JgVEo$|msh_ȢIjߒp[eŧH.E+QC]]ar?$6=OfS&X>
C}1(ۼBm@cv6uReK`̱u$VuަdsmA>R^VeopK2xStl4vo<8# &-yڶwA3}2,ba2$\9T8KbVF3|P$1z|Pcń:{eG&t6T6/ۮ!kpur.`(VBg\'ȣ3ehXhhlW;FIgaLdj+eÛ2ajm*.Gs.TRg$|{vKl^(T?eˢƙU#iel]BבѵQv%kZ:b*8}Q'%h4aQx"0"FL*g^(z.};w|p{-ڇMNg$0{,Ǣ@i F+ȩ(9)ЁҬؒ`Qˇ%)S6.9Ŏ=!%Ǥf.
h:ck&u|%`fINew#uF"ɢ)fiCf
N.9m8ppl'p30$r>u6 ЕtiɝXj4F>կS-#u+
ο?#}KV^-h
$"HOv%;t}q9#_.ӧ3c~Pb5-op$! ^gNPfJg;rsv 9}Ȼ:X/,,9<\$LYT'&\:V)+ 86Lb*FrABnXВfRN̵4Z4 T^$+2b͍O1Yzޝb&"KHc"DA'plCl*7EoaA&ngȐ?XevL,4쉅Xh5=P="sy6ɲϔMd
Ùď
Ϗ!";#+ZQbTJ թ;
(y#˙Ƃ$~$WKLGt/܅\}F$xŽn(<<tĐK(-eZI,ʂ|&TV=@aKxt
vSZ4' Q.ĭx>DR俉~Pq^6kUp+_FdVrL::Oz\L+z'pDVT櫐:uĞał;W=m)}?jendstream
endobj
13 0 obj
1832
endobj
11 0 obj <<
/Type /Page
/Contents 12 0 R
[-=- -=- -=- 1249 lines omitted -=- -=- -=-]
0000062020 00000 n
0000061900 00000 n
0000060530 00000 n
0000061878 00000 n
0000064374 00000 n
0000064254 00000 n
0000062160 00000 n
0000064232 00000 n
0000066804 00000 n
0000066684 00000 n
0000064549 00000 n
0000066662 00000 n
0000069165 00000 n
0000069045 00000 n
0000066967 00000 n
0000069023 00000 n
0000080436 00000 n
0000072059 00000 n
0000071939 00000 n
0000069293 00000 n
0000071917 00000 n
0000073521 00000 n
0000073401 00000 n
0000072210 00000 n
0000073379 00000 n
0000074176 00000 n
0000074056 00000 n
0000073627 00000 n
0000074035 00000 n
0000074282 00000 n
0000076571 00000 n
0000077115 00000 n
0000079193 00000 n
0000079215 00000 n
0000079236 00000 n
0000079257 00000 n
0000079278 00000 n
0000079310 00000 n
0000080537 00000 n
0000080634 00000 n
0000080687 00000 n
trailer
<<
/Size 169
/Root 167 0 R
/Info 168 0 R
>>
startxref
80840
%%EOF
=== Added File Packages/WebService/doc/WebService.ps === (2670/2770 lines abridged)
%!PS-Adobe-2.0
%%Creator: dvipsk 5.86 p1.5d Copyright 1996-2001 ASCII Corp.(www-ptex@ascii.co.jp)
%%based on dvipsk 5.86 Copyright 1999 Radical Eye Software (www.radicaleye.com)
%%Title: WebService.dvi
%%Pages: 34
%%PageOrder: Ascend
%%BoundingBox: 0 0 612 792
%%DocumentFonts: Helvetica Helvetica-Oblique Times-Roman Times-Bold
%%+ Helvetica-Bold Times-Italic Courier Courier-Bold
%%EndComments
%DVIPSWebPage: (www.radicaleye.com)
%DVIPSCommandLine: dvips -N0 -t letter -o WebService.ps WebService.dvi
%DVIPSParameters: dpi=600, compressed
%DVIPSSource: TeX output 2001.11.26:1108
%%BeginProcSet: texc.pro
%!
/TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S
N}B/A{dup}B/TR{translate}N/isls false N/vsize 11 72 mul N/hsize 8.5 72
mul N/landplus90{false}def/@rigin{isls{[0 landplus90{1 -1}{-1 1}ifelse 0
0 0]concat}if 72 Resolution div 72 VResolution div neg scale isls{
landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div hsize
mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul TR[
matrix currentmatrix{A A round sub abs 0.00001 lt{round}if}forall round
exch round exch]setmatrix}N/@landscape{/isls true N}B/@manualfeed{
statusdict/manualfeed true put}B/@copies{/#copies X}B/FMat[1 0 0 -1 0 0]
N/FBB[0 0 0 0]N/nn 0 N/IEn 0 N/ctr 0 N/df-tail{/nn 8 dict N nn begin
/FontType 3 N/FontMatrix fntrx N/FontBBox FBB N string/base X array
/BitMaps X/BuildChar{CharBuilder}N/Encoding IEn N end A{/foo setfont}2
array copy cvx N load 0 nn put/ctr 0 N[}B/sf 0 N/df{/sf 1 N/fntrx FMat N
df-tail}B/dfs{div/sf X/fntrx[sf 0 0 sf neg 0 0]N df-tail}B/E{pop nn A
definefont setfont}B/Cw{Cd A length 5 sub get}B/Ch{Cd A length 4 sub get
}B/Cx{128 Cd A length 3 sub get sub}B/Cy{Cd A length 2 sub get 127 sub}
B/Cdx{Cd A length 1 sub get}B/Ci{Cd A type/stringtype ne{ctr get/ctr ctr
1 add N}if}B/id 0 N/rw 0 N/rc 0 N/gp 0 N/cp 0 N/G 0 N/CharBuilder{save 3
1 roll S A/base get 2 index get S/BitMaps get S get/Cd X pop/ctr 0 N Cdx
0 Cx Cy Ch sub Cx Cw add Cy setcachedevice Cw Ch true[1 0 0 -1 -.1 Cx
sub Cy .1 sub]/id Ci N/rw Cw 7 add 8 idiv string N/rc 0 N/gp 0 N/cp 0 N{
rc 0 ne{rc 1 sub/rc X rw}{G}ifelse}imagemask restore}B/G{{id gp get/gp
gp 1 add N A 18 mod S 18 idiv pl S get exec}loop}B/adv{cp add/cp X}B
/chg{rw cp id gp 4 index getinterval putinterval A gp add/gp X adv}B/nd{
/cp 0 N rw exit}B/lsh{rw cp 2 copy get A 0 eq{pop 1}{A 255 eq{pop 254}{
A A add 255 and S 1 and or}ifelse}ifelse put 1 adv}B/rsh{rw cp 2 copy
get A 0 eq{pop 128}{A 255 eq{pop 127}{A 2 idiv S 128 and or}ifelse}
ifelse put 1 adv}B/clr{rw cp 2 index string putinterval adv}B/set{rw cp
fillstr 0 4 index getinterval putinterval adv}B/fillstr 18 string 0 1 17
{2 copy 255 put pop}for N/pl[{adv 1 chg}{adv 1 chg nd}{1 add chg}{1 add
chg nd}{adv lsh}{adv lsh nd}{adv rsh}{adv rsh nd}{1 add adv}{/rc X nd}{
1 add set}{1 add clr}{adv 2 chg}{adv 2 chg nd}{pop nd}]A{bind pop}
forall N/D{/cc X A type/stringtype ne{]}if nn/base get cc ctr put nn
/BitMaps get S ctr S sf 1 ne{A A length 1 sub A 2 index S get sf div put
[-=- -=- -=- 2670 lines omitted -=- -=- -=-]
a(NS) p 105 3141 V 50 w(XSD) p 305 3141 V 50 w(00) p
Fm 208 3240 a(The) g(v) n(alue) h(of) g(the) g(2000) f(XML) h(Schema) g
(name) n(space.) p Fb 0 3387 a(NS) p 105 3387 V 50 w(XSI) p
305 3387 V 50 w(00) p Fm 208 3487 a(The) f(v) n(alue) h(of) g(the) g
(2000) f(XML) h(Schema) g(instance) f(namespace.) p Fb
0 3634 a(NS) p 105 3634 V 50 w(XSD) p 305 3634 V 50 w(01) p
Fm 208 3733 a(The) g(v) n(alue) h(of) g(the) g(2001) f(XML) h(Schema) g
(name) n(space.) p Fb 0 3880 a(NS) p 105 3880 V 50 w(XSI) p
305 3880 V 50 w(01) p Fm 208 3980 a(The) f(v) n(alue) h(of) g(the) g
(2001) f(XML) h(Schema) g(instance) f(namespace.) p Fb
0 4127 a(InstanceU) n(riForSchem) n(aUri) p Fg(\() p
Fh(uri) p Fg(\)) p Fm 208 4226 a(Returns) 25 b(the) h(appro) n(priate) g
(matchin) n(g) g(XML) g(Schema) f(instance) h(URI) g(for) f(the) h(gi) n
(v) o(en) f(XML) h(Schema) f(namspac) n(e) i(URI,) f(or) p
Fg 208 4326 a(None) p Fm 20 w(if) 20 b(no) g(match) f(is) j(fou) n(nd.)
p Fb 0 4473 a(SchemaUri) n(ForInstanc) n(eUri) p Fg(\() p
Fh(uri) p Fg(\)) p Fm 208 4572 a(Returns) h(the) g(appro) n(priate) g
(matching) f(XML) i(Schema) e(namespace) h(URI) h(for) e(the) i(gi) n
(v) o(e) n(n) g(XML) f(Schema) g(instance) g(URI,) h(or) p
Fg 208 4672 a(None) p Fm 20 w(if) c(no) g(match) f(is) j(fou) n(nd.) p
Fb 0 4819 a(NS) p 105 4819 V 50 w(WSDL) p 355 4819 V
50 w(ALL) p Fm 208 4918 a(A) e(sequence) f(that) i(con) n(tains) g(all)
g(of) f(the) g(suppo) n(rted) g(WSDL) h(namespac) n(es.) p
Fb 0 5065 a(NS) p 105 5065 V 50 w(WSDL) p Fm 208 5165
a(The) e(v) n(alue) h(of) g(the) g(def) o(ault) g(WSDL) g(namespace) f
(\(curren) n(tly) i(the) f(WSDL) h(1.1) e(namespace) n(\).) p
Fb 0 5312 a(WSDLUriTo) n(Version) p Fg(\() p Fh(u) n(ri) p
Fg(\)) p 90 rotate dyy eop
%%Page: 34 34
34 33 bop Fm 208 83 a(Returns) 20 b(a) g(v) o(ersion) f(string) h
(related) g(to) g(the) g(gi) n(v) o(en) f(WSDL) i(namespac) n(e) g
(URI.) p Fb 0 230 a(GetWSDLSo) n(apBindingU) n(ri) p
Fg(\() p Fh(ver) o(sion) p Fg(\)) p Fm 208 330 a(Return) e(an) h(appro)
n(priate) g(namespace) f(URI) i(for) f(the) g(gi) n(v) o(e) n(n) h
(WSDL) p Fh 21 w(ver) o(sion) p Fm(.) p Fb 0 476 a(GetWSDLHt) n
(tpBindingU) n(ri) p Fg(\() p Fh(ver) o(sion) p Fg(\)) p
Fm 208 576 a(Return) e(an) h(appro) n(priate) g(namespace) f(URI) i
(for) f(the) g(gi) n(v) o(e) n(n) h(WSDL) p Fh 21 w(ver) o(sion) p
Fm(.) p Fb 0 723 a(GetWSDLMi) n(meBindingU) n(ri) p Fg(\() p
Fh(ver) o(sion) p Fg(\)) p Fm 208 823 a(Return) e(an) h(appro) n
(priate) g(namespace) f(URI) i(for) f(the) g(gi) n(v) o(e) n(n) h(WSDL)
p Fh 21 w(ver) o(sion) p Fm(.) p Fb 0 969 a(GetWSDLHt) n(tpTranspor) n
(tUri) p Fg(\() p Fh(ver) o(sion) p Fg(\)) p Fm 208 1069
a(Return) e(an) h(appro) n(priate) g(namespace) f(URI) i(for) f(the) g
(gi) n(v) o(e) n(n) h(WSDL) p Fh 21 w(ver) o(sion) p
Fm(.) p 90 rotate dyy eop
%%Trailer
end
userdict /end-hook known{end-hook}if
%%EOF
=== Added File Packages/WebService/doc/WebService.tex ===
\documentclass{manual}
\title{Web Services for Python}
\author{Brian Lloyd}
\authoraddress{
Brian Lloyd, \url{http://www.zope.com}\\
E-mail: \email{brian@zope.com}\\
}
\date{Oct 29, 2001}
\release{1.0}
\setshortversion{1.0}
\begin{document}
\maketitle
\centerline{\strong{COPYRIGHT}}
This software is Copyright \copyright{} Zope Corporation (tm) and
Contributors. All rights reserved.
This license has been certified as open source. It has also been
designated as GPL compatible by the Free Software Foundation (FSF).
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
\begin{enumerate}
\item
Redistributions in source code must retain the above copyright notice,
this list of conditions, and the following disclaimer.
\item
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions, and the following disclaimer in the documentation
and/or other materials provided with the distribution.
\item
The name Zope Corporation (tm) must not be used to endorse or promote
products derived from this software without prior written permission from
Zope Corporation.
\item
The right to distribute this software or to use it for any purpose does not
give you the right to use Servicemarks (sm) or Trademarks (tm) of Zope
Corporation. Use of them is covered in a separate agreement (see
http://www.zope.com/Marks).
\item
If any files are modified, you must cause the modified files to carry
prominent notices stating that you changed the files and the date of any
change.
\end{enumerate}
THIS SOFTWARE IS PROVIDED BY ZOPE CORPORATION ``AS IS''AND ANY EXPRESSED
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
NO EVENT SHALL ZOPE CORPORATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\chapter{Web Services for Python}
\section{Introduction}
Web services are packages of functionality that are published to the
network using Internet standards such as XML and HTTP. These services
can be used as building blocks for other software. They can be thought
of in some ways like a network-wide, cross platform system of reusable
components.
The \citetitle[http://www-106.ibm.com/developerworks/webservices/]{
IBM developerWorks Web Services site} is a good starting point for
learning more about web services. It contains some good beginner
material as well as a number of articles on the benefits (and challenges)
of the web services model.
The documentation for this package assumes that you are familiar with
the general web services landscape and the underlying technologies
(SOAP, WSDL, XML Schema, etc.), though you do not need to be an expert in
the details of these to use the package.
The \module{WebService} package is a toolkit for building and using web
services in Python. It supports the
\citetitle[http://www.w3.org/TR/soap]{SOAP 1.1 specification},
\citetitle[http://www.w3.org/TR/SOAP-attachments]{
SOAP messages with attachments} and
\citetitle[http://www.w3.org/TR/wsdl]{WSDL 1.1}. Future enhancements
will probably include some form of UDDI support.
The \module{WebService} package requires Python 2.0 or later. To support
secure HTTP connections, you will need to have compiled your Python with
SSL support.
\begin{seealso}
\seetitle[http://www.w3.org/TR/soap]
{The SOAP 1.1 specification}
{The SOAP specification defines the protocol that web services use
to communicate.}
\seetitle[http://www.w3.org/TR/wsdl]
{WSDL 1.1: Web Services Description Language}
{The WSDL specification defines the WSDL object model in detail and
may be helpful in better understanding the element-level classes in the
\module{WSDLTools} module and how they should be used.}
\seetitle[http://www.w3.org/TR/xmlschema-0]
{XML Schema Part 0: Primer}
{The XML Schema primer is an introduction to XML Schema, a facility for
describing content structures used for data serialization and interface
discovery in web services.}
\seetitle[http://www.uddi.org/]
{UDDI: Universal Discovery, Description and Integration}
{UDDI is an initiative to enable businesses to quickly, easily and
dynamically transact business with one another using (among other
things) web services.}
\end{seealso}
\section{Getting Started}
The \module{WebService} package provides some high-level tools that make it
easy to get started using and implementing web services. Perhaps more
importantly, the package provides a number of lower-level tools for dealing
with the various technologies involved with web services. This toolkit
approach makes it possible to implement alternate high-level tools without
having to ``start from scratch''. The package tries hard to provide clear
interfaces that make it relatively easy to adapt to different client and
server environments .
This section focuses on getting started using the high-level tools in the
package. For more information on using the lower level objects, see the
examples in the package documentation (or look at the implementation for
the high-level tools, which are themselves built on the low level tools).
\subsection{Using Web Services}
The \module{WebService} package provides two high-level client-side tools
for working with remote web services. The \class{ServiceProxy} class acts
as a proxy for a service that has a WSDL description, and exposes methods
that reflect the methods of the remote service. \class{ServiceProxy} objects
are very straightforward - you initialize a proxy from a WSDL URL, then call
methods on the proxy corresponding to the methods of the remote service.
\begin{verbatim}
from WebService.ServiceProxy import ServiceProxy
service = ServiceProxy('http://www.xmethods.net/sd/BabelFishService.wsdl')
value = service.BabelFish('en_de', 'This is a test!')
\end{verbatim}
The methods of \class{ServiceProxy} instances can be called with positional
arguments (where the argument positions match the message descriptions in the
associated WSDL) or keyword arguments (where the arguments match the message
descriptions by name). Arguments to \class{ServiceProxy} methods must be
compatible with the types required by the WSDL description.
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.
Not all web services have WSDL descriptions - which is where the second
high-level tool comes in. The \class{SOAPMethod} class can be used to make
SOAP calls to services that do not have WSDL descriptions. To use a
\class{SOAPMethod}, you initialize it with information about the SOAP call
such as the method name, endpoint URL, SOAPAction, etc., then call it.
\begin{verbatim}
from WebService.ServiceProxy import SOAPMethod
method = SOAPMethod('EchoString',
url='http://www.example.com/EchoService',
namespace='urn:EchoService',
soapAction=''urn:EchoService#EchoString'
)
result = method(data='Echo this string!')
\end{verbatim}
Note that \class{SOAPMethod} objects take a ``do what I mean'' approach to
calling remote service methods. If no type information is provided, argument
serialization is done using defaults based on the Python types of the
arguments.
TODO: finish this section.
\subsection{Implementing Web Services}
Show some examples of web service implementations in common server
environments. TODO: finish this section.
\input{ServiceProxy}
\input{SOAPMessage}
\input{WSDLTools}
\input{SOAPCallInfo}
\input{SOAPReader}
\input{SOAPWriter}
\input{XMLWriter}
\input{XMLSchema}
\input{Transports}
\input{Utility}
\end{document}
=== Added File Packages/WebService/doc/XMLSchema.tex ===
\section{\module{WebService.XMLSchema}}
\declaremodule{}{WebService.XMLSchema}
The \module{XMLSchema} module provides classes for working with XML
schema descriptions. Note that the goal of this module is *not* to
provide a general-purpose XMLSchema library usable for validation or
other general applications. Rather, this module is intended to
provide just enough support for XML schemas to support web services
goals (primarily data serialization). The \module{XMLSchema} module is
based on the W3C's 2001
\citetitle[http://www.w3.org/TR/xmlschema-0]{XML Schema recommendation}.
The most important classes and exceptions provided by this module
are:
\begin{classdesc}{SchemaReader}{}
The \class{SchemaReader} class provides methods for loading XML schema
descriptions from URLs or XML data.
\end{classdesc}
\begin{classdesc}{XMLSchema}{
\optional{targetNamespace\optional{, name\optional{, documentation}}}
}
\class{XMLSchema} instances represent XML schema descriptions and provide
an object model for working with those descriptions.
\end{classdesc}
\begin{excdesc}{SchemaError}
This exception is raised when errors occur in the parsing or
building of XMLSchema objects, usually indicating invalid structure
or usage.
\end{excdesc}
Note that there are quite a few other classes defined in the
\module{XMLSchema} module that implement the WSDL object model. Instances
of those classes are generally accessed through \class{XMLSchema} objects, and
are documented in the following sections.
\subsection{SchemaReader Objects}
\class{SchemaReader} instances are the main interface for loading XML
schema descriptions from URLs, XML files or XML string data.
\begin{methoddesc}[SchemaReader]{loadFromStream}{file}
Return an \class{XMLSchema} instance representing the schema description
contained in \var{file}. The \var{file} argument must be a seekable
file-like object.
\end{methoddesc}
\begin{methoddesc}[SchemaReader]{loadFromString}{data}
Returns an \class{XMLSchema} instance loaded from an XML string.
\end{methoddesc}
\begin{methoddesc}[SchemaReader]{loadFromFile}{filename}
Returns an \class{XMLSchema} instance loaded from the file named by
\var{filename}.
\end{methoddesc}
\begin{methoddesc}[SchemaReader]{loadFromURL}{url}
Returns an \class{XMLSchema} instance loaded from the given URL.
\end{methoddesc}
\subsection{SchemaReader Example}
Here is an example of using \class{SchemaReader} to load a schema
from a URL and print the names of the global element declarations:
\begin{verbatim}
from WebService.XMLSchema import SchemaReader
reader = SchemaReader()
schema = reader.loadFromURL('http://www.example.com/schemas/someSchema.xml')
for element in schema.elements.values():
print element.name
\end{verbatim}
\subsection{XMLSchema Objects}
\class{XMLSchema} instances implement the XML schema object model. They
are most often created by loading an XML source into a \class{SchemaReader}.
A \class{XMLSchema} object provides access to the structures that make
up a schema description.
\begin{memberdesc}{targetNamespace}
The target namespace associated with the service description, or
\code{None} if not specified.
\end{memberdesc}
\begin{memberdesc}{location}
The URL from which the schema was loaded, or \code{None} if the schema was
not loaded from a URL.
\end{memberdesc}
\begin{memberdesc}{simpleTypes}
TODO: document this.
\end{memberdesc}
\begin{memberdesc}{complexTypes}
TODO: document this.
\end{memberdesc}
\begin{memberdesc}{attrGroups}
TODO: document this.
\end{memberdesc}
\begin{memberdesc}{modelGroups}
TODO: document this.
\end{memberdesc}
\begin{memberdesc}{attributes}
TODO: document this.
\end{memberdesc}
\begin{memberdesc}{elements}
TODO: document this.
\end{memberdesc}
\begin{methoddesc}[WSDL]{toXML}{}
Return an XML string representation of the schema object.
\end{methoddesc}
TODO: finish documenting schema API and subobject APIs.
=== Added File Packages/WebService/doc/XMLWriter.tex ===
\section{\module{WebService.XMLWriter}}
\declaremodule{}{WebService.XMLWriter}
The \module{XMLWriter} module provides a simplified interface for writing
XML documents.
\begin{classdesc}{XMLWriter}{\optional{, encoding}}
The \class{XMLWriter} class manages an internal DOM document, and provides
a way to build XML documents that can be simpler and less verbose than
using raw DOM APIs. If the optional \var{encoding} is specified, that
encoding will be used for the resulting XML document. The default encoding
is \code{UTF-8}.
\end{classdesc}
\subsection{XMLWriter Objects}
\begin{memberdesc}{document}
The DOM document object that underlies the \class{XMLWriter}. You can
use this to work with the DOM document directly if needed. Note that due
to cleanup issues the lifetime of the \code{document} is bound to that of
the \class{XMLWriter}.
\end{memberdesc}
\begin{memberdesc}{encoding}
The encoding to be used for the resulting XML document (the default is
UTF-8).
\end{memberdesc}
\begin{methoddesc}[XMLWriter]{startElement}{
\optional{, namespaceURI\optional{, **attrs}}
}
Begin a new element with the given \var{name} and optional
\var{namespaceURI} at the current point in the document. The return
value is the newly created DOM element.
Any keyword arguments specified in \var{**attrs} will be written as
attributes of the element with the given names and values. Note that
attributes passed this way will not be namespace-qualified in the
resulting XML document. To write namespace-qualified attributes, use
the \method{writeAttr()} method.
\end{methoddesc}
\begin{methoddesc}[XMLWriter]{endElement}{}
End the last started element.
\end{methoddesc}
\begin{methoddesc}[XMLWriter]{currentElement}{}
Returns the currently open element of the document.
\end{methoddesc}
\begin{methoddesc}[XMLWriter]{writeAttr}{
name, value\optional{, namespaceURI}
}
Write an attribute with the given \var{name}, \var{value} and optional
\var{namespaceURI} to the current element in the document. If a
\var{namespaceURI} is specified, a namespace declaration and prefix will
be generated if necessary.
\end{methoddesc}
\begin{methoddesc}[XMLWriter]{writeText}{value}
Write a string to the content of the current element in the XML document.
Any XML special characters in \var{value} will be appropriately escaped.
\end{methoddesc}
\begin{methoddesc}[XMLWriter]{writeCDATA}{value}
Write a CDATA section at the current point in the XML document.
\end{methoddesc}
\begin{methoddesc}[XMLWriter]{writeXML}{value}
Write a literal string to the content of the current element in the XML
document. Any XML special characters in \var{value} will *not* be
escaped.
\end{methoddesc}
\begin{methoddesc}[XMLWriter]{declareNSDefault}{namespaceURI}
Declares the default namespace uri to be used for the XML document. This
must be called before starting to write the document if a default namespace
is to be used.
\end{methoddesc}
\begin{methoddesc}[XMLWriter]{declareNSPrefix}{prefix, namespaceURI}
Adds an XML namespace declaration to the document, associating
\var{prefix} with \var{namespaceURI}. Note that all XML namespace
declarations are made on the root element of the resulting document.
\end{methoddesc}
\begin{methoddesc}[XMLWriter]{getNSPrefix}{namespaceURI}
Return the prefix to be used for the given namespace uri. A namespace
prefix will be generated (and declared in the XML document) if a prefix
for that uri has not yet been declared.
\end{methoddesc}
\begin{methoddesc}[XMLWriter]{hasNSPrefix}{namespaceURI}
Returns true if a prefix has been declared in the document for
\var{namespaceURI}.
\end{methoddesc}
\begin{methoddesc}[XMLWriter]{makeQName}{namespaceURI, name}
Return an appropriate XML qualified name for the given \var{namespaceURI}
and \var{name} (\code{prefix:name}, or simply \code{name} if
\var{namespaceURI} is the default namespace). This value is suitable for
qualified name linking within the document.
\end{methoddesc}
\begin{methoddesc}[XMLWriter]{makeRefId}{}
Return a new unique id usable as the \code{id} attribute of an XML
element for referencing purposes.
\end{methoddesc}
\begin{methoddesc}[XMLWriter]{toString}{\optional{, format}}
Return the XML document as a string (or unicode, depending on the content
and encoding of the document). If the optional \var{format} argument is a
true value, the output will be formatted for readability.
\end{methoddesc}
\subsection{XMLWriter Example}
This example uses an XMLWriter object to produce a simple XML document.
\begin{verbatim}
from WebService.XMLWriter import XMLWriter
writer = XMLWriter()
writer.startElement('numbers')
for n in range(5):
writer.startElement('item')
writer.writeText(str(n))
writer.endElement()
writer.endElement()
xml = writer.toString(1)
\end{verbatim}
In this example, printing the \code{xml} variable would produce:
\begin{verbatim}
<?xml version="1.0" encoding="UTF-8"?>
<numbers>
<item>
0
</item>
<item>
1
</item>
<item>
2
</item>
<item>
3
</item>
<item>
4
</item>
</numbers>
\end{verbatim}