class CountService(soaphandler.SoapHandler):
    """ Service that counts the number of items in a list """
    @webservice(_params=xmltypes.Array(xmltypes.String),
                _returns=xmltypes.Integer)
    def count(self, list_of_values):
        length = len(list_of_values)
        return length
class FibonacciService(soaphandler.SoapHandler):
	""" Service that provides Fibonacci numbers """
	@webservice(_params=xmltypes.Integer,_returns=xmltypes.Array(xmltypes.Integer))
	def fib(self,n):
		a, b = 0, 1
		result = []
		while b < n:
			result.append(b)
			a, b = b, a + b
		return result
示例#3
0
class HelloWorldService2(soaphandler.SoapHandler):
    """ Service that return an list with Hello and World str elements, not uses input parameters """
    @webservice(_params=None, _returns=xmltypes.Array(xmltypes.String))
    def sayHello(self):
        return ["Hello", "World"]