Flask 中的 SOAP 服务器 python3
SOAP server in flask python3
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()
所以我想知道有没有办法在 flask
中创建 wsdl
服务?
flask-spyne
完全不支持 python3
,它已经处于生命周期结束阶段。
参考这个:https://github.com/arskom/spyne/tree/master/examples/flask。
我已验证,它正在运行。
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()
所以我想知道有没有办法在 flask
中创建 wsdl
服务?
flask-spyne
完全不支持 python3
,它已经处于生命周期结束阶段。
参考这个:https://github.com/arskom/spyne/tree/master/examples/flask。 我已验证,它正在运行。