基于wsdl创建pythonsoap服务器 [英] Create python soap server based on wsdl

查看:33
本文介绍了基于wsdl创建pythonsoap服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 wsdl 文件,描述了 Java 产品上的通信服务器-客户端.我正在实现一个基于 Python 的新服务器,它将实现相同的服务.

I have an wsdl file describing the communication server-client on a Java product. I'm implementing a new server based on Python that will implement the same services.

你知道有什么方法可以基于 wsdl 创建 Python 服务器代码,不需要我编写所有涉及的复杂类型吗?

Do you know of any method to create the Python server code based on the wsdl, that does not requires me to write all of the complextypes involved?

另外,您推荐什么 Api?

Also, what Api do you recommend?

推荐答案

当谈到 SOAP 支持时,遗憾的是 Python 不再提供包含电池".客户端的支持是可以接受的,但在服务器端,您基本上是靠自己的.

When it comes to SOAP support, Python unfortunately no longer is with "batteries included". The support on client side is acceptable but on server side you are basically on your own.

对于初学者,您可能想查看以下内容:

You might want to look at the following for starters:

http://wiki.python.org/moin/WebServices

http://pywebsvcs.sourceforge.net/

http://dogellmann.com/2009/09/01/evaluating-tools-for-developing-with-soap-in-python.html

如果你真的想走这条路,似乎ZSI是要使用的工具,尽管我怀疑它是否适用于最新的 2.x Python 发行版.

If you really want to go on this route, it seems that ZSI is the tool to use, although I have my doubts that it will work with the latest 2.x Python distribution.

使用 Python 2.6.6,我尝试使用 ZSI 2.0 从 WSDL 开始构建 Web 服务.使用 wsdl2pywsdl2dispatch 生成代码时收到一些模块已弃用"警告,必须单独安装 PyXML 并破解我的 sys.path 只是为了让它首先解决,否则我会得到模块 ext.reader 不存在",然后只会以令人失望的ZSI:EvaluateException对于基本的Hello world!"错误,nillable(False), minOccurs(1) 元素没有得到.带有必需元素的 WS.

Using Python 2.6.6, I tried to use ZSI 2.0 to build a web service starting from the WSDL. Got some "module has been deprecated" warnings when generating the code with wsdl2py and wsdl2dispatch, had to separately install PyXML and hack my sys.path just to make it resolve first or else I got "module ext.reader does not exist" then only to end up with a disappointing "ZSI:EvaluateException Got None for nillable(False), minOccurs(1) element" error on a basic "Hello world!" WS with a required element.

切换到不再需要 PyXML 的 ZSI 2.1_a1 和 wsdl2py 做这一切(wsdl2dispatch 为 2.0 所做的)但仍然以ZSI:EvaluateException Got None for nillable(False), minOccurs(1) element" 错误.

Switched to ZSI 2.1_a1 which no longer needs PyXML and wsdl2py does it all (what wsdl2dispatch did for 2.0) but still ended up in a dead end with "ZSI:EvaluateException Got None for nillable(False), minOccurs(1) element" errors.

这种体验并不是很有趣,但它足以让我对 Python 必须为 SOAP Web 服务提供的内容形成意见......这并不多(而且这只是基本的 Web 服务,没什么特别的)WS-* 规范).赞!

The experience wasn't very fun but it was enough for me to form an opinion about what Python has to offer for SOAP web services... which ain't much (and that was just for basic web services nothing fancy like WS-* specs). YMMV!

我最近遇到了this SO question,虽然它是面向客户端的解决方案,但它也提到了一些用于构建 SOAP 服务的库.

EDIT : I recently bumped into this SO question, and although oriented versus a client solution, it does also mention a few libraries for building SOAP services.

这篇关于基于wsdl创建pythonsoap服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆