Server (version 0.12.0)
index
/home/groups/p/py/pywebsvcs/src/SOAPpy/Server.py

################################################################################
#
# SOAPpy - Cayce Ullman       (cayce@actzero.com)
#          Brian Matthews     (blm@actzero.com)
#          Gregory Warnes     (Gregory.R.Warnes@Pfizer.com)
#          Christopher Blunck (blunck@gst.com)
#
################################################################################
# Copyright (c) 2003, Pfizer
# Copyright (c) 2001, Cayce Ullman.
# Copyright (c) 2001, Brian Matthews.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# 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.
#
# Neither the name of actzero, inc. nor the names of its contributors may
# be used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS 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 THE REGENTS OR 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.
#
################################################################################

 
Modules
       
BaseHTTPServer
SocketServer
socket
sys
thread

 
Classes
       
BaseHTTPServer.BaseHTTPRequestHandler(SocketServer.StreamRequestHandler)
SOAPRequestHandler
HeaderHandler
MethodSig
SOAPContext
SOAPServerBase
SOAPServer(SOAPServerBase, SocketServer.TCPServer)
SOAPUnixSocketServer(SOAPServerBase, SocketServer.UnixStreamServer)
ThreadingSOAPServer(SOAPServerBase, SocketServer.ThreadingTCPServer)

 
class HeaderHandler
    # A class to describe how header messages are handled
 
  Methods defined here:
__init__(self, header, attrs)
# Initially fail out if there are any problems.

 
class MethodSig
    # Method Signature class for adding extra info to registered funcs, right now
# used just to indicate it should be called with keywords, instead of ordered
# params.
 
  Methods defined here:
__call__(self, *args, **kw)
__init__(self, func, keywords=0, context=0)

 
class SOAPContext
     Methods defined here:
__init__(self, header, body, attrs, xmldata, connection, httpheaders, soapaction)

 
class SOAPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler)
    
Method resolution order:
SOAPRequestHandler
BaseHTTPServer.BaseHTTPRequestHandler
SocketServer.StreamRequestHandler
SocketServer.BaseRequestHandler

Methods defined here:
date_time_string(self)
do_POST(self)
log_message(self, format, *args)
version_string(self)

Methods inherited from BaseHTTPServer.BaseHTTPRequestHandler:
address_string(self)
Return the client address formatted for logging.
 
This version looks up the full hostname using gethostbyaddr(),
and tries to find a name that contains at least one dot.
end_headers(self)
Send the blank line ending the MIME headers.
handle(self)
Handle multiple requests if necessary.
handle_one_request(self)
Handle a single HTTP request.
 
You normally don't need to override this method; see the class
__doc__ string for information on how to handle specific HTTP
commands such as GET and POST.
log_date_time_string(self)
Return the current time formatted for logging.
log_error(self, *args)
Log an error.
 
This is called when a request cannot be fulfilled.  By
default it passes the message on to log_message().
 
Arguments are the same as for log_message().
 
XXX This should go to the separate error log.
log_request(self, code='-', size='-')
Log an accepted request.
 
This is called by send_reponse().
parse_request(self)
Parse a request (internal).
 
The request should be stored in self.raw_requestline; the results
are in self.command, self.path, self.request_version and
self.headers.
 
Return True for success, False for failure; on failure, an
error is sent back.
send_error(self, code, message=None)
Send and log an error reply.
 
Arguments are the error code, and a detailed message.
The detailed message defaults to the short entry matching the
response code.
 
This sends an error response (so it must be called before any
output has been generated), logs the error, and finally sends
a piece of HTML explaining the error to the user.
send_header(self, keyword, value)
Send a MIME header.
send_response(self, code, message=None)
Send the response header and log the response code.
 
Also send two standard headers with the server software
version and the current date.

Data and other attributes inherited from BaseHTTPServer.BaseHTTPRequestHandler:
MessageClass = <class mimetools.Message>
A derived class of rfc822.Message that knows about MIME headers and
contains some hooks for decoding encoded and multipart messages.
error_message_format = '<head>\n<title>Error response</title>\n</head>\n<bo...ode explanation: %(code)s = %(explain)s.\n</body>\n'
monthname = [None, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
protocol_version = 'HTTP/1.0'
responses = {100: ('Continue', 'Request received, please continue'), 101: ('Switching Protocols', 'Switching to new protocol; obey Upgrade header'), 200: ('OK', 'Request fulfilled, document follows'), 201: ('Created', 'Document created, URL follows'), 202: ('Accepted', 'Request accepted, processing continues off-line'), 203: ('Non-Authoritative Information', 'Request fulfilled from cache'), 204: ('No response', 'Request fulfilled, nothing follows'), 205: ('Reset Content', 'Clear input form for further input.'), 206: ('Partial Content', 'Partial content follows.'), 300: ('Multiple Choices', 'Object has several resources -- see URI list'), ...}
server_version = 'BaseHTTP/0.3'
sys_version = 'Python/2.3.4'
weekdayname = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']

Methods inherited from SocketServer.StreamRequestHandler:
finish(self)
setup(self)

Data and other attributes inherited from SocketServer.StreamRequestHandler:
rbufsize = -1
wbufsize = 0

Methods inherited from SocketServer.BaseRequestHandler:
__init__(self, request, client_address, server)

 
class SOAPServer(SOAPServerBase, SocketServer.TCPServer)
    
Method resolution order:
SOAPServer
SOAPServerBase
SocketServer.TCPServer
SocketServer.BaseServer

Methods defined here:
__init__(self, addr=('localhost', 8000), RequestHandler=<class Server.SOAPRequestHandler>, log=0, encoding='UTF-8', config=<Config.SOAPConfig instance>, namespace=None, ssl_context=None)

Methods inherited from SOAPServerBase:
get_request(self)
registerFunction(self, function, namespace='', funcName=None, path='')
registerKWFunction(self, function, namespace='', funcName=None, path='')
# convenience  - wraps your func for you.
registerKWObject(self, object, namespace='', path='')
registerObject(self, object, namespace='', path='')
unregisterObject(self, object, namespace='', path='')

Methods inherited from SocketServer.TCPServer:
close_request(self, request)
Called to clean up an individual request.
fileno(self)
Return socket file number.
 
Interface required by select().
server_activate(self)
Called by constructor to activate the server.
 
May be overridden.
server_bind(self)
Called by constructor to bind the socket.
 
May be overridden.
server_close(self)
Called to clean-up the server.
 
May be overridden.

Data and other attributes inherited from SocketServer.TCPServer:
address_family = 2
allow_reuse_address = False
request_queue_size = 5
socket_type = 1

Methods inherited from SocketServer.BaseServer:
finish_request(self, request, client_address)
Finish one request by instantiating RequestHandlerClass.
handle_error(self, request, client_address)
Handle an error gracefully.  May be overridden.
 
The default is to print a traceback and continue.
handle_request(self)
Handle one request, possibly blocking.
process_request(self, request, client_address)
Call finish_request.
 
Overridden by ForkingMixIn and ThreadingMixIn.
serve_forever(self)
Handle one request at a time until doomsday.
verify_request(self, request, client_address)
Verify the request.  May be overridden.
 
Return True if we should proceed with this request.

 
class SOAPServerBase
    ################################################################################
# SOAP Server
################################################################################
 
  Methods defined here:
get_request(self)
registerFunction(self, function, namespace='', funcName=None, path='')
registerKWFunction(self, function, namespace='', funcName=None, path='')
# convenience  - wraps your func for you.
registerKWObject(self, object, namespace='', path='')
registerObject(self, object, namespace='', path='')
unregisterObject(self, object, namespace='', path='')

 
class SOAPUnixSocketServer(SOAPServerBase, SocketServer.UnixStreamServer)
    
Method resolution order:
SOAPUnixSocketServer
SOAPServerBase
SocketServer.UnixStreamServer
SocketServer.TCPServer
SocketServer.BaseServer

Methods defined here:
__init__(self, addr=8000, RequestHandler=<class Server.SOAPRequestHandler>, log=0, encoding='UTF-8', config=<Config.SOAPConfig instance>, namespace=None, ssl_context=None)

Methods inherited from SOAPServerBase:
get_request(self)
registerFunction(self, function, namespace='', funcName=None, path='')
registerKWFunction(self, function, namespace='', funcName=None, path='')
# convenience  - wraps your func for you.
registerKWObject(self, object, namespace='', path='')
registerObject(self, object, namespace='', path='')
unregisterObject(self, object, namespace='', path='')

Data and other attributes inherited from SocketServer.UnixStreamServer:
address_family = 1

Methods inherited from SocketServer.TCPServer:
close_request(self, request)
Called to clean up an individual request.
fileno(self)
Return socket file number.
 
Interface required by select().
server_activate(self)
Called by constructor to activate the server.
 
May be overridden.
server_bind(self)
Called by constructor to bind the socket.
 
May be overridden.
server_close(self)
Called to clean-up the server.
 
May be overridden.

Data and other attributes inherited from SocketServer.TCPServer:
allow_reuse_address = False
request_queue_size = 5
socket_type = 1

Methods inherited from SocketServer.BaseServer:
finish_request(self, request, client_address)
Finish one request by instantiating RequestHandlerClass.
handle_error(self, request, client_address)
Handle an error gracefully.  May be overridden.
 
The default is to print a traceback and continue.
handle_request(self)
Handle one request, possibly blocking.
process_request(self, request, client_address)
Call finish_request.
 
Overridden by ForkingMixIn and ThreadingMixIn.
serve_forever(self)
Handle one request at a time until doomsday.
verify_request(self, request, client_address)
Verify the request.  May be overridden.
 
Return True if we should proceed with this request.

 
class ThreadingSOAPServer(SOAPServerBase, SocketServer.ThreadingTCPServer)
    
Method resolution order:
ThreadingSOAPServer
SOAPServerBase
SocketServer.ThreadingTCPServer
SocketServer.ThreadingMixIn
SocketServer.TCPServer
SocketServer.BaseServer

Methods defined here:
__init__(self, addr=('localhost', 8000), RequestHandler=<class Server.SOAPRequestHandler>, log=0, encoding='UTF-8', config=<Config.SOAPConfig instance>, namespace=None, ssl_context=None)

Methods inherited from SOAPServerBase:
get_request(self)
registerFunction(self, function, namespace='', funcName=None, path='')
registerKWFunction(self, function, namespace='', funcName=None, path='')
# convenience  - wraps your func for you.
registerKWObject(self, object, namespace='', path='')
registerObject(self, object, namespace='', path='')
unregisterObject(self, object, namespace='', path='')

Methods inherited from SocketServer.ThreadingMixIn:
process_request(self, request, client_address)
Start a new thread to process the request.
process_request_thread(self, request, client_address)
Same as in BaseServer but as a thread.
 
In addition, exception handling is done here.

Data and other attributes inherited from SocketServer.ThreadingMixIn:
daemon_threads = False

Methods inherited from SocketServer.TCPServer:
close_request(self, request)
Called to clean up an individual request.
fileno(self)
Return socket file number.
 
Interface required by select().
server_activate(self)
Called by constructor to activate the server.
 
May be overridden.
server_bind(self)
Called by constructor to bind the socket.
 
May be overridden.
server_close(self)
Called to clean-up the server.
 
May be overridden.

Data and other attributes inherited from SocketServer.TCPServer:
address_family = 2
allow_reuse_address = False
request_queue_size = 5
socket_type = 1

Methods inherited from SocketServer.BaseServer:
finish_request(self, request, client_address)
Finish one request by instantiating RequestHandlerClass.
handle_error(self, request, client_address)
Handle an error gracefully.  May be overridden.
 
The default is to print a traceback and continue.
handle_request(self)
Handle one request, possibly blocking.
serve_forever(self)
Handle one request at a time until doomsday.
verify_request(self, request, client_address)
Verify the request.  May be overridden.
 
Return True if we should proceed with this request.

 
Functions
       
GetSOAPContext()

 
Data
        Config = <Config.SOAPConfig instance>
StringTypes = (<type 'str'>, <type 'unicode'>)
__version__ = '0.12.0'
ident = '$Id: Server.py 1298 2006-11-07 00:54:15Z sanxiyn $'
nested_scopes = _Feature((2, 1, 0, 'beta', 1), (2, 2, 0, 'alpha', 0), 16)