This requires that you install soaplib.
We assume this soaplib server:
from soaplib.wsgi_soap import SimpleWSGISoapApp
from soaplib.service import soapmethod
from soaplib.serializers.primitive import *
from time import ctime
from wsgiref.simple_server import make_server
class MyServer(SimpleWSGISoapApp):
@soapmethod(_returns=String)
def get_time(self):
return ctime() # service implementation
make_server('', 8001, MyServer()).serve_forever()
The create this web2py controller that gets the time from the soap server
from soaplib.client import make_service_client
from soaplib.wsgi_soap import SimpleWSGISoapApp
from soaplib.service import soapmethod
from soaplib.serializers.primitive import *
class MyServer(SimpleWSGISoapApp):
@soapmethod(_returns=String)
def get_time(self):
return '' # service stub
def index():
### connect to server
client=make_service_client('localhost:8001/',MyServer())
### call remote function
return client.get_time()