Overview of features
Home
Read this first
About
web2py is 100% free
Download
Start learning web2py today
Documentation
Authors and contributors
Staff
Affiliated companies
Support
Edit page
Title:
Security Code:
Body:
(use
this
wiki markup)
## Using soap with web2py This requires that you install soaplib. ## The server (pure Python + 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 client (in web2py) 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()