WSDL が壊れているようです。ImportDoctor
ここで、SUDS が提供する を使用する必要があります。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)
注目に値することの 1 つは、URL http://schemas.microsoft.com/2003/10/Serialization/Arraysは有効でさえない (404 を返す) ことです。そのため、それが正しい URL であるかどうかはわかりません。私は少なくともあなたを正しい方向に導いていると確信しています.
最近のコメント (2010-10-05) に応じて編集します。
提供された URL を使用し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')
、それらのオブジェクトをユーザー名/パスワードとともに渡す必要があります。