AlterEgo
old web2py blog
Useful Links
List all entries
Book
Interactive Examples
F.A.Q.
Free Applications
Plugins
Recipes
Demo of Admin Interface
Semantic web extension
Some of the information here may be outdated, please check the book instead
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()
© 2008-2010 by Massimo Di Pierro - All rights reserved - Powered by
web2py
- design derived from a theme by
the earlybird
The content of this book is released under the
Artistic License 2.0
- Modified content cannot be reproduced.