Beispiel #1
0
def main(argv):
    observer = log.PythonLoggingObserver('twisted')
    log.startLoggingWithObserver(observer.emit, setStdout=False)

    wsgi_application = WsgiApplication(soap_application)

    return run_twisted( [ (wsgi_application, url) ], port )
Beispiel #2
0
def main(argv):
    observer = log.PythonLoggingObserver('twisted')
    log.startLoggingWithObserver(observer.emit, setStdout=False)

    wsgi_application = WsgiApplication(soap_application)

    return run_twisted([(wsgi_application, url)], port)
from rpclib.util.wsgi_wrapper import run_twisted

'''
This is the HelloWorld example running in the twisted framework.
'''

class HelloWorldService(ServiceBase):
    @srpc(String, Integer, _returns=Array(String))
    def say_hello(name, times):
        '''Docstrings for service methods appear as documentation in the wsdl.

        @param name the name to say hello to
        @param the number of times to say hello
        @return the completed array
        '''
        results = []
        for i in range(0, times):
            results.append('Hello, %s' % name)

        return results

if __name__=='__main__':
    application = Application([HelloWorldService], 'rpclib.examples.hello.twisted',
                interface=Wsdl11(), in_protocol=Soap11(), out_protocol=Soap11())
    wsgi_app = WsgiApplication(application)

    print 'listening on 0.0.0.0:7789'
    print 'wsdl is at: http://0.0.0.0:7789/app/?wsdl'

    run_twisted( ( (wsgi_app, "app"),), 7789)
Beispiel #4
0
from rpclib.model.primitive import Integer
from rpclib.model.primitive import String

'''
This is the HelloWorld example running in the twisted framework.
'''

class HelloWorldService(DefinitionBase):
    @rpc(String, Integer, _returns=Array(String))
    def say_hello(self, name, times):
        '''Docstrings for service methods appear as documentation in the wsdl.

        @param name the name to say hello to
        @param the number of times to say hello
        @return the completed array
        '''
        results = []
        for i in range(0, times):
            results.append('Hello, %s' % name)

        return results

if __name__=='__main__':
    soap_app=rpclib.Application([HelloWorldService], 'tns')
    wsgi_app=wsgi.Application(soap_app)

    print 'listening on 0.0.0.0:7789'
    print 'wsdl is at: http://0.0.0.0:7789/SOAP/?wsdl'

    run_twisted( ( (wsgi_app, "SOAP"),), 7789)
Beispiel #5
0
    if "session-id" not in cookie:
        raise UnauthenticatedError()
    session_cookie = cookie["session-id"].value
    session_id = tuple(base64.urlsafe_b64decode(session_cookie).split("\0", 1))
    if not session_id in session_db:
        raise AuthenticationError(session_id[0])
    ctx.udc = session_id[0]     # user name


UserService.event_manager.add_listener('method_call', _on_method_call)

if __name__=='__main__':
    from rpclib.util.wsgi_wrapper import run_twisted

    logging.basicConfig(level=logging.DEBUG)
    logging.getLogger('rpclib.protocol.xml').setLevel(logging.DEBUG)
    logging.getLogger('twisted').setLevel(logging.DEBUG)

    application = Application([UserService],
        tns='rpclib.examples.authentication',
        interface=Wsdl11(),
        in_protocol=Soap11(validator='lxml'),
        out_protocol=Soap11()
    )

    twisted_apps = [
        (WsgiApplication(application), 'app'),
    ]

    sys.exit(run_twisted(twisted_apps, 7789))
Beispiel #6
0

class HelloWorldService(ServiceBase):
    @srpc(String, Integer, _returns=Array(String))
    def say_hello(name, times):
        '''Docstrings for service methods appear as documentation in the wsdl.

        @param name the name to say hello to
        @param the number of times to say hello
        @return the completed array
        '''
        results = []
        for i in range(0, times):
            results.append('Hello, %s' % name)

        return results


if __name__ == '__main__':
    application = Application([HelloWorldService],
                              'rpclib.examples.hello.twisted',
                              interface=Wsdl11(),
                              in_protocol=Soap11(),
                              out_protocol=Soap11())
    wsgi_app = WsgiApplication(application)

    print('listening on 0.0.0.0:7789')
    print('wsdl is at: http://0.0.0.0:7789/app/?wsdl')

    run_twisted(((wsgi_app, "app"), ), 7789)
Beispiel #7
0
    if "session-id" not in cookie:
        raise UnauthenticatedError()
    session_cookie = cookie["session-id"].value
    session_id = tuple(base64.urlsafe_b64decode(session_cookie).split("\0", 1))
    if not session_id in session_db:
        raise AuthenticationError(session_id[0])
    ctx.udc = session_id[0]     # user name
    

UserService.event_manager.add_listener('method_call', _on_method_call)

if __name__=='__main__':
    from rpclib.util.wsgi_wrapper import run_twisted

    logging.basicConfig(level=logging.DEBUG)
    logging.getLogger('rpclib.protocol.xml').setLevel(logging.DEBUG)
    logging.getLogger('twisted').setLevel(logging.DEBUG)

    application = Application([UserService],
        tns='rpclib.examples.authentication',
        interface=Wsdl11(),
        in_protocol=Soap11(validator='lxml'),
        out_protocol=Soap11()
    )

    twisted_apps = [
        (WsgiApplication(application), 'app'),
    ]

    sys.exit(run_twisted(twisted_apps, 7789))
Beispiel #8
0
from rpclib.model.primitive import String
'''
This is the HelloWorld example running in the twisted framework.
'''


class HelloWorldService(DefinitionBase):
    @rpc(String, Integer, _returns=Array(String))
    def say_hello(self, name, times):
        '''Docstrings for service methods appear as documentation in the wsdl.

        @param name the name to say hello to
        @param the number of times to say hello
        @return the completed array
        '''
        results = []
        for i in range(0, times):
            results.append('Hello, %s' % name)

        return results


if __name__ == '__main__':
    soap_app = rpclib.Application([HelloWorldService], 'tns')
    wsgi_app = wsgi.Application(soap_app)

    print 'listening on 0.0.0.0:7789'
    print 'wsdl is at: http://0.0.0.0:7789/SOAP/?wsdl'

    run_twisted(((wsgi_app, "SOAP"), ), 7789)