suds 中的“<故障代码>”是什么意思?未映射到消息部分”?
我是第一次使用 suds,并尝试与外部公司托管的服务器进行通信。当我调用服务器上的方法时,我会返回此 XML。
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Can't use string ("") as an ARRAY ref while "strict refs" in use at /vindicia/site_perl/Vindicia/Soap/DocLitUtils.pm line 130.
</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
抛出的异常是这样的:
File "C:\Python26\lib\site-packages\suds-0.4-py2.6.egg\suds\client.py", line 538, in __call__ return client.invoke(args, kwargs) File "C:\Python26\lib\site-packages\suds-0.4-py2.6.egg\suds\client.py", line 602, in invoke result = self.send(msg) File "C:\Python26\lib\site-packages\suds-0.4-py2.6.egg\suds\client.py", line 634, in send result = self.succeeded(binding, reply.message) File "C:\Python26\lib\site-packages\suds-0.4-py2.6.egg\suds\client.py", line 669, in succeeded r, p = binding.get_reply(self.method, reply) File "C:\Python26\lib\site-packages\suds-0.4-py2.6.egg\suds\bindings\binding.py", line 157, in get_reply result = self.replycomposite(rtypes, nodes) File "C:\Python26\lib\site-packages\suds-0.4-py2.6.egg\suds\bindings\binding.py", line 227, in replycomposite raise Exception(' not mapped to message part' % tag) Exception: 'faultcode' not mapped to message part
知道为什么 suds 抛出异常吗?关于如何修复它有什么想法吗?
I'm using suds for the first time and trying to communicate with a server hosted by an external company. When I call a method on the server I get this XML back.
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Can't use string ("") as an ARRAY ref while "strict refs" in use at /vindicia/site_perl/Vindicia/Soap/DocLitUtils.pm line 130.
</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
The exception thrown is this:
File "C:\Python26\lib\site-packages\suds-0.4-py2.6.egg\suds\client.py", line 538, in __call__ return client.invoke(args, kwargs) File "C:\Python26\lib\site-packages\suds-0.4-py2.6.egg\suds\client.py", line 602, in invoke result = self.send(msg) File "C:\Python26\lib\site-packages\suds-0.4-py2.6.egg\suds\client.py", line 634, in send result = self.succeeded(binding, reply.message) File "C:\Python26\lib\site-packages\suds-0.4-py2.6.egg\suds\client.py", line 669, in succeeded r, p = binding.get_reply(self.method, reply) File "C:\Python26\lib\site-packages\suds-0.4-py2.6.egg\suds\bindings\binding.py", line 157, in get_reply result = self.replycomposite(rtypes, nodes) File "C:\Python26\lib\site-packages\suds-0.4-py2.6.egg\suds\bindings\binding.py", line 227, in replycomposite raise Exception(' not mapped to message part' % tag) Exception: 'faultcode' not mapped to message part
Any idea why suds is throwing the exception? Any thoughts on how it could be fixed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我遇到了类似的问题,呼叫成功,并且肥皂水在解析客户端的响应时崩溃。我使用的解决方法是使用 suds 选项返回原始 XML< /a> 然后使用 BeautifulSoup 解析响应。
例子:
I had a similar issue where the call was successful, and suds crashed on parsing the response from the client. The workaround I used was to use the suds option to return raw XML and then use BeautifulSoup to parse the response.
Example:
已经在这里回答:什么是suds 的意思是“未映射到消息部分”?
这个异常实际上意味着 SOAP 服务的答案包含标签
,而存在于服务的 WSDL 方案中。请记住,suds 库会缓存 WSDL 方案,这就是如果最近更改 WSDL 方案可能会出现问题的原因。然后,答案与新方案匹配,但由 suds-client 与旧方案进行验证。在这种情况下,
rm /tmp/suds/*
将为您提供帮助。Already answered here: What does suds mean by "<faultcode/> not mapped to message part"?
This exception actually means that the answer from SOAP-service contains tag
<faultcode>
, which doesn't exist in the WSDL-scheme of the service.Keep in mind that suds library caches the WSDL-scheme, that is why the problem may occur if the WSDL-scheme was changed recently. Then the answers match the new scheme, but are verified by the suds-client with the old one. In this case
rm /tmp/suds/*
will help you.