私はphpにサンプルコードを持っています:
$conditions = Array(
"status_id" => "1"
);
$params = Array(
"method" => "call",
"params" => Array($session, "order.list.filter",
Array($conditions, "order_id", 10)
)
それをPythonに変換する方法が見つかりません。
私はコードを持っています:
imp = Import('http://schemas.xmlsoap.org/soap/encoding/')
imp.filter.add('http://decorations.pl/webapi/soap/')
doctor = ImportDoctor(imp)
url = 'http://decorations.pl/webapi/soap/?wsdl'
print url
client = Client(url, doctor=doctor)
print client
それは私に与えます:
Suds ( https://fedorahosted.org/suds/ ) version: 0.4 GA build: R699-20100913
Service ( Webapi_Soap_ApiService ) tns="http://decorations.pl/webapi/soap/"
Prefixes (1)
ns0 = "http://schemas.xmlsoap.org/soap/encoding/"
Ports (1):
(Webapi_Soap_ApiPort)
Methods (11):
aquireApplicationLock(xs:string session, xs:string message, xs:boolean stealLock, )
call(xs:string session, xs:string function, xs:anyType arguments, )
checkApplicationLock(xs:string session, )
checkObjectListModificationTime(xs:string session, xs:int objectType, ns0:Array list, )
checkObjectLock(xs:string session, xs:int objectType, xs:int id, )
checkObjectModificationTime(xs:string session, xs:int objectType, xs:int id, )
getApplicationLock(xs:string session, )
login(xs:string login, xs:string password, )
logout(xs:string session, )
releaseApplicationLock(xs:string session, xs:boolean stealLock, )
updateApplicationLock(xs:string session, xs:boolean stealLock, )
Types (48):
ns0:Array
ns0:ENTITIES
ns0:ENTITY
ns0:ID
ns0:IDREF
ns0:IDREFS
ns0:NCName
ns0:NMTOKEN
ns0:NMTOKENS
ns0:NOTATION
ns0:Name
ns0:QName
ns0:Struct
ns0:anyURI
ns0:arrayCoordinate
ns0:base64
ns0:base64Binary
ns0:boolean
ns0:byte
ns0:date
ns0:dateTime
ns0:decimal
ns0:double
ns0:duration
ns0:float
ns0:gDay
ns0:gMonth
ns0:gMonthDay
ns0:gYear
ns0:gYearMonth
ns0:hexBinary
ns0:int
ns0:integer
ns0:language
ns0:long
ns0:negativeInteger
ns0:nonNegativeInteger
ns0:nonPositiveInteger
ns0:normalizedString
ns0:positiveInteger
ns0:short
ns0:string
ns0:time
ns0:token
ns0:unsignedByte
ns0:unsignedInt
ns0:unsignedLong
ns0:unsignedShort
そして、作業呼び出しを構築する方法がわかりません...「order.list.filter」を呼び出す機能があります。
# after login...
conditions = ""
params = client.factory.create('ns0:Array')
params.Array = [ conditions , "order_id", 10]
lista = client.service.call(sesId, 'order.list.filter', parametry)
print lista
私に与えます:
[1, 9, 10, 11, 12, 13, 14, 15, 16, 17]
しかし、php のような結果が得られる条件を構築することはできません。「ns0:Struct」を使用していくつかの例を見つけようとしましたが、次で終わらないコードを書くことができません:
File ".\test.py", line 143, in <module>
lista = client.service.call(sesId, 'order.list.filter', parametry)
File "build\bdist.win32\egg\suds\client.py", line 542, in __call__
File "build\bdist.win32\egg\suds\client.py", line 602, in invoke
File "build\bdist.win32\egg\suds\client.py", line 649, in send
File "build\bdist.win32\egg\suds\client.py", line 702, in failed
File "build\bdist.win32\egg\suds\bindings\binding.py", line 265, in get_fault
suds.WebFault: Server raised fault: 'Unknown error'