但是注意,async=False ,这个参数问题在3.7版本中有问题,spyne 库会有报错。 综上,所以选用spyne进行开发了。 服务端样例代码: https://github.com/arskom/spyne/blob/master/examples/helloworld_soap.py #! /usr/bin/env python # -*- coding: utf-8 -*- """ preference: http://spyne.io/docs/2.10/index.html import rpc # spyne.service.ServiceBase is the base class for all service definitions. from spyne import
from soaplib.core.model.clazz import ClassModel from spyne import Application, rpc, ServiceBase from spyne import Integer, Unicode, Array from spyne.protocol.soap import Soap11 from spyne.server.wsgi import WsgiApplication from wsgiref.simple_server import make_server import sys from spyne.model.complex import 服务端的logging文件 logging.basicConfig(level=logging.DEBUG, filename='my_server.log') logging.getLogger('spyne.application.server
<方法名> 方法参数 </方法名> </Body> </Envelope> 3 、源码实例 服务端源码 from spyne import Application, rpc, ServiceBase, Iterable, Integer, Unicode, String # 如果支持soap的协议需要用到Soap11 from spyne.protocol.soap import Soap11 # 可以创建一个wsgi服务器,做测试用 from spyne.server.wsgi import WsgiApplication class HelloWorldService1 wsgiref.simple_server import make_server logging.basicConfig(level=logging.DEBUG) logging.getLogger('spyne.protocol.xml