Python/Suds:找不到类型:'xs:complexType'
我有以下简单的 python 测试脚本,它使用 Suds 调用 SOAP Web 服务(该服务是用 ASP 编写的) .net):
from suds.client import Client
url = 'http://someURL.asmx?WSDL'
client = Client( url )
result = client.service.GetPackageDetails( "MyPackage" )
print result
当我运行此测试脚本时,出现以下错误(使用代码标记,因为它不换行):
No handlers could be found for logger "suds.bindings.unmarshaller"
Traceback (most recent call last):
File "sudsTest.py", line 9, in <module>
result = client.service.GetPackageDetails( "t3db" )
File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 240, in __call__
File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 379, in call
File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 240, in __call__
File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 422, in call
File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 480, in invoke
File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 505, in send
File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 537, in succeeded
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/binding.py", line 149, in get_reply
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 303, in process
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 88, in process
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 104, in append
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 181, in append_children
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 104, in append
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 181, in append_children
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 104, in append
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 181, in append_children
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 102, in append
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 324, in start
suds.TypeNotFound: Type not found: 'xs:complexType'
查看 WSDL 文件标头的源(重新格式化以适合):
<?xml version="1.0" encoding="utf-8" ?>
<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://http://someInternalURL/webservices.asmx"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="http://someURL.asmx"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
我根据最后的猜测输出行:
suds.TypeNotFound: Type not found: 'xs:complexType'
我需要使用 Sud 的 doctor 类 来修复架构,但作为SOAP 新手我不知道我的情况到底需要修复什么。这里有人有使用 Suds 修复/更正模式的经验吗?
I have the following simple python test script that uses Suds to call a SOAP web service (the service is written in ASP.net):
from suds.client import Client
url = 'http://someURL.asmx?WSDL'
client = Client( url )
result = client.service.GetPackageDetails( "MyPackage" )
print result
When I run this test script I am getting the following error (used code markup as it doesn't wrap):
No handlers could be found for logger "suds.bindings.unmarshaller"
Traceback (most recent call last):
File "sudsTest.py", line 9, in <module>
result = client.service.GetPackageDetails( "t3db" )
File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 240, in __call__
File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 379, in call
File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 240, in __call__
File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 422, in call
File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 480, in invoke
File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 505, in send
File "build/bdist.cygwin-1.5.25-i686/egg/suds/client.py", line 537, in succeeded
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/binding.py", line 149, in get_reply
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 303, in process
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 88, in process
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 104, in append
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 181, in append_children
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 104, in append
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 181, in append_children
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 104, in append
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 181, in append_children
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 102, in append
File "build/bdist.cygwin-1.5.25-i686/egg/suds/bindings/unmarshaller.py", line 324, in start
suds.TypeNotFound: Type not found: 'xs:complexType'
Looking at the source for the WSDL file's header (reformatted to fit):
<?xml version="1.0" encoding="utf-8" ?>
<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://http://someInternalURL/webservices.asmx"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="http://someURL.asmx"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
I am guessing based on the last line of output:
suds.TypeNotFound: Type not found: 'xs:complexType'
That I need to use Sud's doctor class to fix the schema but being a SOAP newbie I don't know what exactly needs fixed in my case. Does anyone here have any experience using Suds to fix/correct schema?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Ewall的资源是一个很好的资源。如果您尝试在 suds trac 票证中搜索,您可能会发现其他人也遇到与您类似的问题 ,但具有不同的对象类型。这是学习示例以及它们如何导入名称空间的好方法。
所有重点都是我的)。
您可以尝试使用这些文档提供的行来添加 WSDL 中提供的命名空间。这可能是一种试错方法。
您没有提供您正在使用的 WSDL,我想您有理由不向我们展示...所以我认为您必须自己尝试这些可能性。祝你好运!
Ewall's resource is a good one. If you try to search in suds trac tickets, you could see that other people have problems similar to yours, but with different object types. It can be a good way to learn from it's examples and how they import their namespaces.
(all emphasis were mine).
You could try the lines that these documentations provide adding the namespaces presented in your WSDL. This can be a try-and-error aproach.
You didn't provide the WSDL you're working with, I suppose you have reasons to not showing to us... so I think you have to try these possibilities by yourself. Good luck!