未找到类型:'(ArrayOfint,http://schemas.microsoft.com/2003/10/Serialization/Arrays,)' 是肥皂水解决方案提出来的。 在... 2003/10 / Serialization / Arrays中定义了ArrayOfInt,所以我猜linux的区分大小写就是问题所在。 任何想法我怎么能解决这个问题?
from suds.client import Client
c = Client("https://developer-api.affili.net/V2.0/Logon.svc?wsdl")
用于返回
Type not found: '(ArrayOfint, http://schemas.microsoft.com/2003/10/Serialization/Arrays, )'
现在几天后我甚至都没有到那里,而是得到了一个
TypeNotFound: Type not found: '(Logon, http://affilinet.framework.webservices/types, )'
答案 0 :(得分:6)
听起来你的WSDL已经坏了。这是您需要使用SUDS提供的ImportDoctor
的地方。您需要使用它来帮助Client
构造函数使用ArrayOfint
中的http://schemas.microsoft.com/2003/10/Serialization/Arrays
类型。
我过去使用过其他服务但是没有看到你的WSDL或你的代码,这只是我最好的猜测你如何解决它,因为我不能自己测试它:
from suds.client import Client
from suds.xsd.doctor import Import, ImportDoctor
# Obviously I made this up
wsdl_url = 'http://whatever/path/to/wsdl'
# Fix missing types with ImportDoctor
schema_url = 'http://schemas.microsoft.com/2003/10/Serialization/Arrays'
schema_import = Import(schema_url)
schema_doctor = ImportDoctor(schema_import)
# Pass doctor to Client
client = Client(url=wsdl_url, doctor=schema_doctor)
有一点值得注意的是,URL http://schemas.microsoft.com/2003/10/Serialization/Arrays甚至不是有效的(它返回404),所以我真的不确定这是否是正确的URL。虽然我确信我至少会引导你朝着正确的方向前进。
根据您最近的评论(2010-10-05)编辑:
使用您提供的https://developer-api.affili.net/V2.0/Logon.svc?wsdl
网址,我能够成功创建客户端。我不得不使用ImportDoctor
,因为它引发了以下错误:
TypeNotFound: Type not found: '(Logon, http://affilinet.framework.webservices/types, )'
所以我使用了以下代码,并且能够获得一个成功的客户端对象:
from suds.client import Client
from suds.xsd.doctor import Import, ImportDoctor
wsdl_url = 'https://developer-api.affili.net/V2.0/Logon.svc?wsdl'
schema_url = 'http://affilinet.framework.webservices/types'
schema_import = Import(schema_url)
schema_doctor = ImportDoctor(schema_import)
client = Client(url=wsdl_url, doctor=schema_doctor)
打印客户端对象显示:
Suds(https://fedorahosted.org/suds/)版本:0.3.9 GA版本:R659-20100219
Service ( Authentication ) tns="http://affilinet.framework.webservices/Svc"
Prefixes (5)
ns0 = "http://affilinet.framework.webservices/types"
ns1 = "http://schemas.datacontract.org/2004/07/Microsoft.Practices.EnterpriseLibrary.Validation.Integration.WCF"
ns2 = "http://schemas.microsoft.com/2003/10/Serialization/"
ns3 = "http://schemas.microsoft.com/2003/10/Serialization/Arrays"
ns4 = "http://www.microsoft.com/practices/EnterpriseLibrary/2007/01/wcf/validation"
Ports (1):
(DefaultEndpointLogon)
Methods (2):
GetIdentifierExpiration(xs:string CredentialToken, )
Logon(xs:string Username, xs:string Password, ns0:WebServiceTypes WebServiceType, ns0:TokenDeveloperDetails DeveloperSettings, ns0:TokenApplicationDetails ApplicationSettings, )
Types (12):
ns3:ArrayOfKeyValueOfstringstring
ns1:ArrayOfValidationDetail
ns0:Logon
ns0:TokenApplicationDetails
ns0:TokenDeveloperDetails
ns1:ValidationDetail
ns4:ValidationFault
ns0:WebServiceTypes
ns0:affilinetWebserviceFault
ns2:char
ns2:duration
ns2:guid
在使用client.service.Logon()
之前,您必须满足该方法所需的类型签名。您必须使用client.factory.create()
(例如client.factory.create('ns0:WebServiceTypes')
)创建各种类型的对象,并将这些对象与您的用户名/密码一起传递。