用soaplib 创建 WebService
来源:互联网 发布:怎么查看端口是否打开 编辑:程序博客网 时间:2024/05/17 16:55
经过多次实验失败的总结,发现官方给的soaplib或是yum, pip ,easy_install 安装的都会存在问题(Python2.7)。所以把这个记下来以防不时之需。一定要从这里下载,才能保证源码可运行。
soaplib 组件下载
import soaplibfrom soaplib.service import rpcfrom soaplib.service import DefinitionBasefrom soaplib.model.primitive import String, Integerfrom soaplib.server import wsgifrom soaplib.model.clazz import Array'''This is a simple HelloWorld example to show the basics of writinga webservice using soaplib, starting a server, and creating a serviceclient.'''class HelloWorldService(DefinitionBase): @rpc(String, Integer, _returns=Array(String)) def say_hello(self, name, times): ''' Docstrings for service methods appear as documentation in the wsdl <b>what fun</b> @param name the name to say hello to @param the number of times to say hello @return the completed array ''' results = [] for i in range(0, times): results.append('Hello, %s' % name) return resultsif __name__=='__main__': try: from wsgiref.simple_server import make_server soap_application = soaplib.Application([HelloWorldService], 'tns') wsgi_application = wsgi.Application(soap_application) print "listening to http://0.0.0.0:80" print "wsdl is at: http://127.0.0.1:80/?wsdl" server = make_server('223.223.83.238',80, wsgi_application) server.serve_forever() except ImportError: print "Error: example server code requires Python >= 2.5"~
阅读全文
0 0
- 用soaplib 创建 WebService
- soaplib实现Webservice
- Python开发WebService--使用soaplib库
- Python开发WebService--使用soaplib库
- Python开发WebService--使用soaplib库
- 关于pyhon/pyinstaller/cxfreeze/soaplib/webservice的使用
- [Python]利用soaplib访问webservice的实例代码
- 利用soaplib搭建webservice详细步骤和实例代码
- 用myeclipse创建webservice
- 用eclipse创建WebService项目
- 创建WebService
- webservice创建
- 用eclipse创建WebService Step by Step
- 用eclipse创建WebService Step by Step
- 用eclipse创建WebService Step by Step
- 用eclipse创建WebService Step by Step
- 用VS2012创建和使用WebService
- 用eclipse创建WebService Step by Step
- Android网络(1)--学习笔记
- 再谈机器学习中的归一化方法(Normalization Method)
- Kaggel实战:识别手写体[knn改进算法]
- 设计模式--模板方式模式
- R中的数据结构(Array,Factor,List,DataFrame)
- 用soaplib 创建 WebService
- PAT乙级(Basic)题库---1003
- 欢迎使用CSDN-markdown编辑器
- linux下文件权限管理介绍
- 跳表分析与实现
- bzoj1912: [Apio2010]patrol 巡逻
- 从入门到入门-Spring Boot-属性配置
- OSG数学基础:坐标系变换
- 南京研究所第三届Hackathon(编程马拉松)之旅