[Fedora-suds-list] also, how do I write a service? (Phlip)

Patrick Surry patrick.surry at gmail.com
Sat Jun 19 01:41:18 UTC 2010


Full disclosure: I know next to nothing about web services, and not sure
what kind of service you want, but I was able to create a simple RESTful
service with cherrypy (www.cherrypy.org) very quickly.   Namely a service
you access by 'GET'ing a URL that includes the relevant parameters.   For
example, if you start the following script, then you can visit
http://localhost:8080/doNothing?param=value to call it.

import cherrypy                 # lightweight python web server

class SimpleService:
  # define the method handler to be passed named parameters in the URL query
  def doNothing(self, param=''):
    result = '<?xml version="1.0" encoding="UTF-8"?><result>%s</result>'
%param  #really we should escape and encode param
    cherrypy.response.headers['Content-Type'] = "text/xml"
    return result
  # expose this function as a URL  
  doNothing.exposed = True

# start the service, defaults to listening on port 8080
cherrypy.quickstart(SimpleService)	

Cheers,
Patrick



I have to write a service, not use one.

Sorry for the FAQ, but googling for it just returns zillions of hits
that refer to suds /accessing/ a service.

-- 
  Phlip
  http://c2.com/cgi/wiki?ZeekLand




More information about the suds mailing list