ServiceContainer
index
/home/groups/p/py/pywebsvcs/src/ZSI/ServiceContainer.py

Simple Service Container
-- use with wsdl2py generated modules.

 
Modules
       
cStringIO
os
re
ZSI.resolvers
sys
thread
types
urlparse

 
Classes
       
exceptions.Exception
NoSuchService
NotAuthorized
PostNotSpecified
SOAPActionNotSpecified
ServiceAlreadyPresent
UnknownRequestException
WSActionException
WSActionNotSpecified
BaseHTTPServer.HTTPServer(SocketServer.TCPServer)
ServiceContainer
SOAPContext
ZSI.dispatch.SOAPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler)
SOAPRequestHandler
ServiceInterface
ServiceSOAPBinding
SimpleWSResource
WSAResource

 
class NoSuchService(exceptions.Exception)
     Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class NotAuthorized(exceptions.Exception)
     Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class PostNotSpecified(exceptions.Exception)
     Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class SOAPActionNotSpecified(exceptions.Exception)
     Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class SOAPContext
     Methods defined here:
__init__(self, container, xmldata, ps, connection, httpheaders, soapaction)

 
class SOAPRequestHandler(ZSI.dispatch.SOAPRequestHandler)
    SOAP handler.
 
 
Method resolution order:
SOAPRequestHandler
ZSI.dispatch.SOAPRequestHandler
BaseHTTPServer.BaseHTTPRequestHandler
SocketServer.StreamRequestHandler
SocketServer.BaseRequestHandler

Methods defined here:
do_GET(self)
The GET command.
do_POST(self)
The POST command.
action -- SOAPAction(HTTP header) or wsa:Action(SOAP:Header)

Methods inherited from ZSI.dispatch.SOAPRequestHandler:
send_fault(self, f, code=500)
Send a fault.
send_xml(self, text, code=200)
Send some XML.

Data and other attributes inherited from ZSI.dispatch.SOAPRequestHandler:
server_version = 'ZSI/1.1 BaseHTTP/0.3'

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.
date_time_string(self)
Return the current date and time formatted for a message header.
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_message(self, format, *args)
Log an arbitrary message.
 
This is used by all other logging functions.  Override
it if you have specific logging wishes.
 
The first argument, FORMAT, is a format string for the
message to be logged.  If the format string contains
any % escapes requiring parameters, they should be
specified as subsequent arguments (it's just like
printf!).
 
The client host and current date/time are prefixed to
every message.
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.
version_string(self)
Return the server software version string.

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'), ...}
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 ServiceAlreadyPresent(exceptions.Exception)
     Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class ServiceContainer(BaseHTTPServer.HTTPServer)
    HTTPServer that stores service instances according 
to POST values.  An action value is instance specific,
and specifies an operation (function) of an instance.
 
 
Method resolution order:
ServiceContainer
BaseHTTPServer.HTTPServer
SocketServer.TCPServer
SocketServer.BaseServer

Methods defined here:
__call__(self, ps, post, action, address=None)
ps -- ParsedSoap representing the request
post -- HTTP POST --> instance
action -- Soap Action header --> method
address -- Address instance representing WS-Address
__init__(self, server_address, services=[], RequestHandlerClass=<class ServiceContainer.SOAPRequestHandler>)
server_address -- 
RequestHandlerClass --
__str__(self)
getNode(self, url)
removeNode(self, url)
setNode(self, service, url=None)

Data and other attributes defined here:
NodeTree = <class ServiceContainer.NodeTree>
Simple dictionary implementation of a node tree

Methods inherited from BaseHTTPServer.HTTPServer:
server_bind(self)
Override server_bind to store the server name.

Data and other attributes inherited from BaseHTTPServer.HTTPServer:
allow_reuse_address = 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().
get_request(self)
Get the request and client address from the socket.
 
May be overridden.
server_activate(self)
Called by constructor to activate the server.
 
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
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 ServiceInterface
    Defines the interface for use with ServiceContainer Handlers.
 
class variables:
    soapAction -- dictionary of soapAction keys, and operation name values.
       These are specified in the WSDL soap bindings. There must be a 
       class method matching the operation name value.  If WS-Action is
       used the keys are WS-Action request values, according to the spec
       if soapAction and WS-Action is specified they must be equal.
       
    wsAction -- dictionary of operation name keys and WS-Action 
       response values.  These values are specified by the portType.
 
    root -- dictionary of root element keys, and operation name values.
 
  Methods defined here:
__init__(self, post)
__str__(self)
authorize(self, auth_info, post, action)
getOperation(self, ps, action)
Returns a method of class.
action -- soapAction value
getOperationName(self, ps, action)
Returns operation name.
action -- soapAction value
getPost(self)
sign(self, sw)
verify(self, ps)

Data and other attributes defined here:
root = {}
soapAction = {}
wsAction = {}

 
class ServiceSOAPBinding(ServiceInterface)
    Binding defines the set of wsdl:binding operations, it takes as input a
ParsedSoap instance and parses it into a pyobj.  It returns a response pyobj.
 
  Methods defined here:
__call___(self, action, ps)
__init__(self, post)

Methods inherited from ServiceInterface:
__str__(self)
authorize(self, auth_info, post, action)
getOperation(self, ps, action)
Returns a method of class.
action -- soapAction value
getOperationName(self, ps, action)
Returns operation name.
action -- soapAction value
getPost(self)
sign(self, sw)
verify(self, ps)

Data and other attributes inherited from ServiceInterface:
root = {}
soapAction = {}
wsAction = {}

 
class SimpleWSResource(ServiceSOAPBinding)
    
Method resolution order:
SimpleWSResource
ServiceSOAPBinding
ServiceInterface

Methods defined here:
getCallBack(self, ps, post, action)
post -- POST HTTP value
action -- SOAP Action value
getNode(self, post)
post -- POST HTTP value
setNode(self, service, post)
service -- service instance
post -- POST HTTP value

Methods inherited from ServiceSOAPBinding:
__call___(self, action, ps)
__init__(self, post)

Methods inherited from ServiceInterface:
__str__(self)
authorize(self, auth_info, post, action)
getOperation(self, ps, action)
Returns a method of class.
action -- soapAction value
getOperationName(self, ps, action)
Returns operation name.
action -- soapAction value
getPost(self)
sign(self, sw)
verify(self, ps)

Data and other attributes inherited from ServiceInterface:
root = {}
soapAction = {}
wsAction = {}

 
class UnknownRequestException(exceptions.Exception)
     Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class WSAResource(ServiceSOAPBinding)
    Simple WSRF service, performs method resolutions based
on WS-Action values rather than SOAP Action.
 
class variables:
    encoding  
    wsAction -- Must override to set output Action values.
    soapAction -- Must override to set input Action values.
 
 
Method resolution order:
WSAResource
ServiceSOAPBinding
ServiceInterface

Methods defined here:
__call___(self, action, ps, address)
__init__(self, post)
post -- POST value
do_POST(self)
The POST command.  This is called by HTTPServer, not twisted.
action -- SOAPAction(HTTP header) or wsa:Action(SOAP:Header)
getOperation(self, ps, address)
Returns a method of class.
address -- ws-address
getResponseAction(self, ps, action)
Returns response WS-Action if available
action -- request WS-Action value.
getServiceURL(self)
setServiceURL(self, url)

Data and other attributes defined here:
encoding = 'UTF-8'

Methods inherited from ServiceInterface:
__str__(self)
authorize(self, auth_info, post, action)
getOperationName(self, ps, action)
Returns operation name.
action -- soapAction value
getPost(self)
sign(self, sw)
verify(self, ps)

Data and other attributes inherited from ServiceInterface:
root = {}
soapAction = {}
wsAction = {}

 
class WSActionException(exceptions.Exception)
     Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class WSActionNotSpecified(WSActionException)
    
Method resolution order:
WSActionNotSpecified
WSActionException
exceptions.Exception

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)