【问题标题】:Hello world example for spyne SOAP serverspyne SOAP 服务器的 Hello world 示例
【发布时间】:2013-02-28 08:58:46
【问题描述】:

我正在试验几个不同的 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。

【问题讨论】:

    标签: python soap suds spyne


    【解决方案1】:

    对于这种混乱,我深表歉意。

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

    用来说明一个suds的bug,在my own version of suds中修复,但在主流suds中没有。后来我忘记将它还原回主 Spyne 存储库。

    您可以找到relevant commit here

    Suds 无法处理名称空间与targetNamespace 不同的传出标头对象。您可以通过设置 SomeObject.__namespace__ = 'spyne.examples.hello.soap' 而不是 'aaa' 来使您的 suds 版本起作用。

    您也可以只删除在 helloworld 示例中不合适的传出标头声明。

    我希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多