from SimpleXMLRPCServer import SimpleXMLRPCServer

class DateServer ( SimpleXMLRPCServer ):

    allow_reuse_address = True

    def _dispatch ( self, method, params ):
        try:
            func = getattr ( self, 'export_' + method )
        except AttributeError:
            raise Exception('method "%s" is not supported' % method)
        else:
            return func ( *params )

    def export_echoDate ( self, the_date ):
        print "Received date: ", repr ( the_date ), the_date.__class__
        return the_date


server = DateServer( ( "localhost", 8111 ) )
server.serve_forever()

