2

I wrote a python script to have a soap server with flask, it's exactly like what the documentation says:

from time import ctime
from flask import Flask
from flaskext.enterprise import Enterprise


if __name__ == '__main__':
    app = Flask(__name__)
    enterprise = Enterprise(app)

    class DemoService(enterprise.SOAPService):

        @enterprise.soap(_returns=enterprise._sp.String)
        def get_time(self):
            return ctime()

But when I run the program, it says:

Traceback (most recent call last):
  File "D:/Workspace/src/flask_soap_server.py", line 3, in <module>
    from flaskext.enterprise import Enterprise
  File "C:\Python27\lib\site-packages\flaskext\enterprise.py", line 20, in <module>
    from soaplib.core import Application
ImportError: No module named core

I also wrote a client to call this server's WSDL address:

from flaskext.enterprise import Enterprise
from flask import Flask


if __name__ == '__main__':

    app = Flask(__name__)
    enterprise = Enterprise(app)
    client = enterprise.connect_to_soap_service('http://192.168.20.232:8000/_enterprise/soap?wsdl')
    @app.route('/time')
    def index():
        time = client.service.get_time()
Zeinab Abbasimazar
  • 9,835
  • 23
  • 82
  • 131

1 Answers1

0

Soaplib (https://github.com/soaplib/soaplib):

This project is discontinued. Please head over to github.com/arskom/spyne for the next version.

Flask Enterprise (https://pypi.python.org/pypi/Flask-Enterprise): latest release in 2011

Maybe it's time to move on to a better supported projects :)

There is a Spyne + Flask example: https://github.com/arskom/spyne/tree/master/examples/flask

Messa
  • 24,321
  • 6
  • 68
  • 92