- make classes for SOAP Server and Client
git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/gnuviech.info/gnuviechadmin/trunk@163 a67ec6bc-e5d5-0310-a910-815c51eb3124
This commit is contained in:
parent
c6ef649c08
commit
c7940b520c
1 changed files with 35 additions and 8 deletions
|
@ -1,11 +1,38 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
#
|
||||
# File: soapserver.py
|
||||
# (c) 2006 Jan Dittberner <jan@dittberner.info>
|
||||
# $Id$
|
||||
#
|
||||
from SOAPpy import SOAPServer
|
||||
import logging
|
||||
|
||||
def echo(s):
|
||||
return s + s
|
||||
|
||||
server = SOAPServer(("localhost", 8080))
|
||||
server.registerFunction(echo)
|
||||
|
||||
server.serve_forever()
|
||||
class GnuviechAdminSOAPServer:
|
||||
"""
|
||||
SOAP Server class for the gnuviech administration tool backend
|
||||
"""
|
||||
def echo(self, s):
|
||||
self.logger.debug("calling echo with " + s)
|
||||
#(sock, address) = self.server.get_request()
|
||||
#self.logger.debug("socket " + sock)
|
||||
#self.logger.debug("address" + address)
|
||||
return s + s
|
||||
|
||||
def __init__(self):
|
||||
self.logger = logging.getLogger('GnuviechAdminSOAPServer')
|
||||
hdlr = logging.FileHandler('soapserver.log')
|
||||
hdlr.setFormatter(logging.Formatter('%(asctime)s %(levelname)s %(message)s'))
|
||||
self.logger.addHandler(hdlr)
|
||||
self.logger.setLevel(logging.DEBUG)
|
||||
self.server = SOAPServer(("127.0.0.1", 8080))
|
||||
self.logger.debug("created SOAPServer")
|
||||
self.server.registerFunction(self.echo)
|
||||
self.logger.debug("registered function echo")
|
||||
|
||||
def main(self):
|
||||
self.logger.debug("serving SOAP")
|
||||
self.server.serve_forever()
|
||||
|
||||
if __name__ == "__main__":
|
||||
server = GnuviechAdminSOAPServer()
|
||||
server.main()
|
Loading…
Reference in a new issue