python-3.xflasksoapspyne

SOAP server in flask python3


the spyne lib can create wsdlserver, the wsdl example code:

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()

so i am wondering is there a way to create wsdlservice in flask?
flask-spyne is not support python3 at all and it's already in life-end.


Solution

  • refer this: https://github.com/arskom/spyne/tree/master/examples/flask. I verified and it's working.