Flask python3 中的 SOAP 服务器

问题描述

spyne 库可以创建wsdl服务器,wsdl 示例代码

from spyne.application import Application
from spyne.decorator import rpc
from spyne import ServiceBase,String
from spyne.protocol.soap import Soap11
from spyne.server.wsgi import WsgiApplication
from wsgiref.simple_server import make_server


class Test(ServiceBase):
    @rpc(String,_returns=String)
    def get_data(self,post_data):
        return process_xml_data(post_data)


app = Application([Test],'http://schemas.xmlsoap.org/soap/envelope',in_protocol=Soap11(validator='lxml'),out_protocol=Soap11())
wsgi_app = WsgiApplication(app)

if __name__ == '__main__':
    server = make_server('0.0.0.0',8080,wsgi_app)
    server.serve_forever()

所以我想知道有没有办法在wsdl中创建flask服务?
flask-spyne 根本不支持 python3,而且它已经生命尽头了。

解决方法

请参考:https://github.com/arskom/spyne/tree/master/examples/flask。 我验证了,它正在工作。