Skip to content

The Classic Hello World!!!

rancavil edited this page Jan 3, 2012 · 6 revisions

We will develop the classic hello world!!! like a SOAP web service.

The code of the web service Hello World is:

   import tornado.httpserver
   import tornado.ioloop
   from tornadows import soaphandler
   from tornadows import webservices
   from tornadows import xmltypes
   from tornadows.soaphandler import webservice

   class HelloWorldService(soaphandler.SoapHandler):
         """ Service that return the current temperature, not uses input parameters """
         @webservice(_params=None,_returns=xmltypes.String)
         def sayHello(self):
             return "Hello World!!!"
   
   if __name__ == '__main__':
       service = [('HelloWorldService',HelloWorldService)]
       app = webservices.WebService(service)
       ws  = tornado.httpserver.HTTPServer(app)
       ws.listen(8080)
       tornado.ioloop.IOLoop.instance().start()