设置
我正在尝试通过其WSDL soap客户端检查我的bookkeeping system中是否存在特定的(客户)关系。
尝试
在其documentation之后,我已经成功连接到我的帐户,
from suds.client import Client
url = 'https://soap.e-boekhouden.nl/soap.asmx?wsdl'
c = Client(url)
user = 'me'
sec1 = 'security_code_1'
sec2 = 'security_code_2'
osResult = c.service.OpenSession(user,sec1,sec2)
然后我检查该函数以获取系统中的所有关系,即print(GetRelaties)
给出
(GetRelaties){
SessionID = None
SecurityCode2 = None
cFilter =
(cRelatieFilter){
Trefwoord = None
Code = None
ID = None
}
}
如果我想检查关系'Vervoort'
是否在系统中,我需要使用GetRelaties
函数,即
GetRelaties = c.factory.create('GetRelaties')
GetRelaties.SessionID = osResult.SessionID
GetRelaties.SecurityCode2 = sec2
cRelatieFilter = c.factory.create('cRelatieFilter')
cRelatieFilter.Trefwoord = 'Vervoort'
GetRelaties.cFilter = cRelatieFilter
就这样
print(GetRelaties)
(GetRelaties){
SessionID = "{FDC2C855-E2E2-49F2-A62E-0373E8279821}"
SecurityCode2 = "C218B421-885C-4B7F-8313-C1B0F77B8F88"
cFilter =
(cRelatieFilter){
Trefwoord = "Vervoort"
Code = None
ID = None
}
}
请注意,对于通话,我需要提供SessionID
和SecurityCode2
。
错误
完成所有这些操作后,我执行c.service.GetRelaties(GetRelaties)
,它给出了
Traceback (most recent call last):
File "<ipython-input-118-1f7334c4e16b>",line 1,in <module>
c.service.GetRelaties(GetRelaties)
File "/opt/anaconda3/lib/python3.7/site-packages/suds/client.py",line 558,in __call__
return client.invoke(args,kwargs)
File "/opt/anaconda3/lib/python3.7/site-packages/suds/client.py",line 611,in invoke
soapenv = binding.get_message(self.method,args,kwargs)
File "/opt/anaconda3/lib/python3.7/site-packages/suds/bindings/binding.py",line 120,in get_message
content = self.bodycontent(method,kwargs)
File "/opt/anaconda3/lib/python3.7/site-packages/suds/bindings/document.py",line 64,in bodycontent
p = self.mkparam(method,pd,value)
File "/opt/anaconda3/lib/python3.7/site-packages/suds/bindings/document.py",line 106,in mkparam
return Binding.mkparam(self,method,pdef,object)
File "/opt/anaconda3/lib/python3.7/site-packages/suds/bindings/binding.py",line 289,in mkparam
return marshaller.process(content)
File "/opt/anaconda3/lib/python3.7/site-packages/suds/mx/core.py",line 60,in process
self.append(document,content)
File "/opt/anaconda3/lib/python3.7/site-packages/suds/mx/core.py",line 73,in append
self.appender.append(parent,content)
File "/opt/anaconda3/lib/python3.7/site-packages/suds/mx/appender.py",line 102,in append
appender.append(parent,line 243,in append
Appender.append(self,child,cont)
File "/opt/anaconda3/lib/python3.7/site-packages/suds/mx/appender.py",line 182,in append
self.marshaller.append(parent,line 72,in append
if self.start(content):
File "/opt/anaconda3/lib/python3.7/site-packages/suds/mx/literal.py",line 87,in start
raise TypeNotFound(content.tag)
TypeNotFound: Type not found: 'SessionID'
我在这里做什么错了?