1
0
Fork 0
gnuviechadmin-historic/backend/src/SOAPServer.py

40 lines
1.1 KiB
Python

#!/usr/bin/python
#
# (c) 2006 Jan Dittberner <jan@dittberner.info>
# $Id$
#
from ZSI.ServiceContainer import ServiceContainer
from ZSI.dispatch import SOAPRequestHandler
from gnuviechadmin_services_server import *
class mySOAPRequestHandler(SOAPRequestHandler):
'''
Own SOAP request handler implementation.
'''
def do_GET(self):
'''
Process the HTTP GET method, delivers service's WSDL.
'''
self.send_xml(service._wsdl)
def AsServer(iporhost='', port=80, services=(),
RequestHandlerClass=SOAPRequestHandler):
"""
iporhost -- IP address or hostname to bind to
port -- TCP port
services -- list of service instances
"""
address = (iporhost, port)
sc = ServiceContainer(address, RequestHandlerClass=RequestHandlerClass)
for service in services:
path = service.getPost()
sc.setNode(service, path)
sc.serve_forever()
service = gnuviechadmin()
if __name__ == '__main__':
AsServer(iporhost='localhost', port=8080, services=[service],
RequestHandlerClass=mySOAPRequestHandler)