2

我正在尝试几个不同的 Python SOAP 服务器库,但我似乎无法让spyne的“hello world”示例工作: https ://github.com/arskom/spyne/blob/master/examples/ helloworld_soap.py

当我运行它时,它会启动一个 SOAP 服务器,我可以在浏览器中成功地查看 WSDL http://localhost:7789/?wsdl。但是,当我尝试连接 suds 客户端时,出现异常:

Python 2.7.3 (default, Aug  1 2012, 05:14:39) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from suds.client import Client
>>> c = Client('http://localhost:7789/?wsdl')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/acordiner/ve/local/lib/python2.7/site-packages/suds/client.py", line 112, in __init__
    self.wsdl = reader.open(url)
  File "/home/acordiner/ve/local/lib/python2.7/site-packages/suds/reader.py", line 152, in open
    d = self.fn(url, self.options)
  File "/home/acordiner/ve/local/lib/python2.7/site-packages/suds/wsdl.py", line 158, in __init__
    self.resolve()
  File "/home/acordiner/ve/local/lib/python2.7/site-packages/suds/wsdl.py", line 207, in resolve
    c.resolve(self)
  File "/home/acordiner/ve/local/lib/python2.7/site-packages/suds/wsdl.py", line 661, in resolve
    self.resolveheaders(definitions, op)
  File "/home/acordiner/ve/local/lib/python2.7/site-packages/suds/wsdl.py", line 725, in resolveheaders
    raise Exception, "message'%s', not-found" % mn
Exception: message's0:SomeObject', not-found

我可能做错了什么?我正在使用 spyne 2.9.4 和 suds 0.4。

4

1 回答 1

6

对于这种混乱,我很抱歉。

您链接到的示例是:https ://github.com/arskom/spyne/blob/ec2bd6feb89fb36915b7266497c177e4c6f78b83/examples/helloworld_soap.py

用来说明一个 suds 的 bug,在我自己的 suds 版本中修复,但在主流 suds 中没有。后来我忘记将它恢复到主 Spyne 存储库中。

你可以在这里找到相关的提交

Suds 无法处理名称空间不同于targetNamespace. 您可以通过设置SomeObject.__namespace__ = 'spyne.examples.hello.soap'而不是'aaa'.

无论如何,您也可以删除在 helloworld 示例中不合适的传出标头声明。

我希望这有帮助。

于 2013-03-01T11:06:24.520 回答