我是python的新手,并使用suds来使用SOAP服务中的数据。我打电话给服务时遇到这个错误。其他不需要我发送一些参数的调用工作正常。但是这项服务给我带来了以下错误。 有人可以帮我理解这个错误是什么吗? primary只是类devline的一个属性,它是一个布尔值。
criteria = connection.factory.create('criteria')
devline = connection.factory.create('devline')
devline.primary = True
devline.source ="abc"
devline.name = "xyz"
devline.hybridType = "xyz"
criteria.primaryDevline = devline
criteria.pairedDevlines = []
criteria.criteriaNumber = None
标准看起来像这样:
(criteriaKey){
primaryDevline =
(devline){
primary = None
sourceBase = None
devlineName = None
hybridType =
(hybridType){
value = None
}
}
pairedDevlines[] = <empty>
criteriaNumber = None
}
当我尝试使用response = connection.service.somemethod(criteria,criteriaState.PUBLISHED)
我收到以下错误:
self = <suds.mx.literal.Literal instance at 0x103fd8998>
content = (Content){
tag = "primary"
value = True
type = None
}
> ???
E TypeNotFound: Type not found: 'primary'
File "/Users/nkimidi/projects/firstws/cca/ezcommit-client/test/unit/service/build/bdist.macosx-10.8-intel/egg/suds/mx/literal.py", line 87
TypeNotFound
=========================== 1 failed in 0.27 seconds ===========================
答案 0 :(得分:0)
当我使用devline作为字典而不是上面使用的方法时,这开始工作。浪费了1天。
答案 1 :(得分:0)
而不是:
devline.primary = True
devline.source ="abc"
devline.name = "xyz"
devline.hybridType = "xyz"
cKey.primaryDevline = devline
cKey.pairedDevlines = []
cKey.criteriaNumber = None
此代码段已经有效:
devline = {
'primary':1,
'sourceBase':sourceBase,
'devlineName' : devlineName,
'hybridType' : hybridType
}
cKey['primaryDevline'] = devline
cKey['pairedDevlines'] = []
cKey['criteriaNumber'] = None
suds的文档说任何方法都可行,但之前的方法对我不起作用。