views:

25

answers:

0

Error I am getting:

Traceback (most recent call last): File "client.py", line 11, in print client.say_hello("Dave",5) AttributeError: 'ServiceClient' object has no attribute 'say_hello'

Server Code:

#!/usr/bin/env python

from soaplib.wsgi_soap import SimpleWSGISoapApp
from soaplib.service import soapmethod
from soaplib.serializers.primitive import String, Integer, Array

class HelloWorldService(SimpleWSGISoapApp):
    @soapmethod(String,Integer,_returns=Array(String))
    def say_hello(self,name,times):
        results = []
        for i in range(0,times):
            results.append('Hello, %s'%name)
        return results

if __name__=='__main__':
    from wsgiref.simple_server import make_server
server = make_server('localhost', 7755, HelloWorldService())
server.serve_forever()

Client Code:

#!/usr/bin/env python

from soaplib.client import make_service_client
from soaplib.wsgi_soap import SimpleWSGISoapApp

class HelloWorldService(SimpleWSGISoapApp):
    def say_hello(self, name, times):
        pass

client = make_service_client('http://localhost:7755/',HelloWorldService())
print client.say_hello("Dave",5)