我正在使用SOAP Web服务,它使用的是suds (0.4)。我使用的WSDL抛出suds抛出错误'type not found'正在使用SOAP服务
>>> import uuid
>>> from suds.client import Client
>>> wsdl = 'https://toolkit.dnb.com/locked/resource/docs/TransactionAndMessageDefinition/ProductList.wsdl'
>>> client = Client(wsdl)
我消费的服务需要一个参数productListRequest
,这是一个复杂的类型,你把UserId
,Password
和复杂类型的ProductListInput
错误。
我填补这些有:
>>> productListRequest = client.factory.create('productListRequest')
>>> productListRequest.UserId = 'myusername'
>>> productListRequest.Password = 'mypassword'
>>> productListRequest.TRNUID = uuid.uuid4()
>>> ProductListInput = client.factory.create('ProductListInput')
>>> ProductListInput.DnB_DUNS_Number = ''
>>> ProductListInput.Product = 'Product Name'
>>> ProductListInput.CountryCode = 'IT'
>>> ProductListInput.TradeUp = ''
>>> ProductListInput.Reason = ''
>>> productListRequest.ProductListInput = ProductListInput
但每当我打电话的服务:
>>> print client.service.ws_ProductList(productListRequest)
我得到Type not found: 'ArrayOfUPD_FLDSItem'
我真的被困在这里。我把这个错误用了两天,老实说我不知道该怎么办!也许对WSDL和泡沫更深入了解的人可以提供帮助。
所以我的问题:
这是WSDL,这我消耗正确定义?如果WSDL不正确的定义(如果是正确的定义,我将其报告给皂液 维护者)
,有一种解决方法(例如 泡架构医生),以将其固定到泡沫的网站?
是否有另一个Python库,我应该使用?
我已将完整的日志文件发布到http://pastebin.com/ZJJFXZaG,因为它包含在这里大。所以我的理解是,我得到了服务的回应,但是通过泡沫本身对已知数据结构的阅读和应用似乎失败了。 – jazz
放入pdb并逐行扫描从违规行到失败的每行代码......您应该看到何时类型跟踪机器不再跟踪该轨迹 –
我已经接受了您的答案,但它会很棒,如果您已经提出了更多的WSDL ;-) – jazz