我写了一个python脚本,有一个带有烧瓶的肥皂服务器,它与documentation所说的完全一样:
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()
但是当我运行该程序时,它说:
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
我还写了一个客户端来调用这个服务器的WSDL地址:
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()
答案 0 :(得分:0)
Soaplib(https://github.com/soaplib/soaplib):
此项目已停止。请转到 github.com/arskom/spyne用于下一个版本。
Flask Enterprise(https://pypi.python.org/pypi/Flask-Enterprise):2011年最新版本
也许现在是时候进入更好的支持项目了:)
有一个Spyne + Flask示例:https://github.com/arskom/spyne/tree/master/examples/flask