What does suds mean by “<faultcode/> not mapped to message part”?
我第一次使用suds并尝试与外部公司托管的服务器通信。当我在服务器上调用一个方法时,我会返回这个XML。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <?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> |
引发的异常是:
1 2 3 4 5 6 7 8 9 10 11 12 13 | 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在解析客户机的响应时崩溃了。我使用的解决方法是使用suds选项返回原始XML,然后使用beautifulsoup解析响应。
例子:
1 2 3 4 5 | client = Client(url) client.set_options(retxml=True) soapresp_raw_xml = client.service.submit_func(data) soup = BeautifulStoneSoup(soapresp_raw_xml) value_i_want = soup.find('ns:NewSRId') |
这里已经回答:suds的"
这个异常实际上意味着SOAP服务的答案包含了标签
请记住,suds库缓存WSDL方案,这就是如果最近更改了WSDL方案可能会出现问题的原因。然后,答案与新方案相匹配,但由SUDS客户机与旧方案进行验证。在这种情况下,