Guest User

Untitled

a guest
Feb 26th, 2013
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.94 KB | None | 0 0
  1. from spyne.service import ServiceBase
  2. from spyne.decorator import rpc
  3. from spyne.model.primitive import *
  4. from spyne.model.complex import *
  5.  
  6.  
  7.  
  8. class test(ServiceBase):
  9.  
  10.     @rpc(Float, _returns=Integer)
  11.     def test(ctx, quota):
  12.         return 10
  13.  
  14.  
  15. if __name__ == "__main__":
  16.     from spyne.interface.wsdl import Wsdl11
  17.     from spyne.protocol.soap import Soap11
  18.     from spyne.application import Application
  19.     from spyne.server.wsgi import WsgiApplication
  20.  
  21.     from wsgiref.simple_server import make_server
  22.  
  23.     logging.basicConfig(level=logging.DEBUG)
  24.     logging.getLogger("spyne.protocol.xml").setLevel(logging.DEBUG)
  25.  
  26.     app = Application([test], "test", interface=Wsdl11(), in_protocol=Soap11(validator="soft"), out_protocol=Soap11())
  27.  
  28.     host = "127.0.0.1"
  29.     port = 8080
  30.  
  31.     server = make_server(host, port, WsgiApplication(app))
  32.  
  33.     print "listening on: http://%s:%s/" % (host, port)
  34.     print "WSDL: http://%s:%s/?wsdl" % (host, port)
  35.  
  36.     server.serve_forever()
Advertisement
Add Comment
Please, Sign In to add comment