alfonsodg / demo-web2py

Apache License 2.0
0 stars 0 forks source link

SOAP support using pysimplesoap #84

Closed alfonsodg closed 10 years ago

alfonsodg commented 10 years ago

From reingart@gmail.com on July 27, 2010 01:42:14

Attached is a patch to add SOAP service support for web2py using the library PySimpleSoap

It extends Service class with soap decorator and soap_serve method. See Web2Py page for detailed information: http://code.google.com/p/pysimplesoap/wiki/Web2Py Example:

service = Service(globals()) @service.soap('MyFunction',returns={'result':int},args={'a':int,'b':int,}) def myfunction(a, b): return a + b def call(): return service()

Then call it with:

def test_myfunction(): from gluon.contrib.pysimplesoap.client import SoapClient client = SoapClient(wsdl = "http://localhost:8000/webservices/sample/call/soap?WSDL" response = client.MyFunction(a=1,b=2) return {'result':response['result']}

Live online example at: https://www.web2py.com.ar/webservices/sample/call/soap Online Test at: https://www.web2py.com.ar/webservices/sample/test_soap_sub More info at: http://code.google.com/p/pysimplesoap

Attachment: tools-pysimplesoap-101.diff

Original issue: http://code.google.com/p/web2py/issues/detail?id=85

alfonsodg commented 10 years ago

From massimod...@gmail.com on July 28, 2010 15:08:37

The patch is in

Status: Fixed

alfonsodg commented 10 years ago

From reingart@gmail.com on August 03, 2010 23:48:08

Attached is a patch with a minor fix and update in @soap documentation: added missing closing } and simplified call example

Also, there is a newer version of PySimpleSoap (1.02a) with improved client WSDL support, see: http://code.google.com/p/pysimplesoap/source/list New simplified example:

service = Service(globals()) @service.soap('MyFunction',returns={'result':int},args={'a':int,'b':int,}) def myfunction(a, b): return a + b def call(): return service()

def test(): from gluon.contrib.pysimplesoap.client import SoapClient client = SoapClient( wsdl="http://localhost:8000/app/default/call/soap?WSDL" response = client.MyFunction(a=1,b=2) return response['result']

Exposes online generated documentation and xml example messages at:

Attachment: tools-pysimplesoap-102.diff