suds抛出错误“类型未找到",消耗SOAP服务 [英] suds throwing error 'type not found' consuming SOAP service

查看:103
本文介绍了suds抛出错误“类型未找到",消耗SOAP服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用肥皂(0.4)使用SOAP Web服务.我正在使用的 WSDL 会引发错误

I am consuming a SOAP webservice with suds (0.4). The WSDL I am using throws an error

>>> import uuid
>>> from suds.client import Client
>>> wsdl = 'https://toolkit.dnb.com/locked/resource/docs/TransactionAndMessageDefinition/ProductList.wsdl'
>>> client = Client(wsdl) 

我正在使用的服务期望一个参数productListRequest,这是您将UserIdPasswordProductListInput的复杂类型放在其中的复杂类型.

The service I am consuming expects one parameter productListRequest, which is a complex type where you put UserId, Password and a complex type of 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

但是,每当我致电该服务时:

But whenever I am calling the service:

>>> print client.service.ws_ProductList(productListRequest)

我得到Type not found: 'ArrayOfUPD_FLDSItem'

我真的被困在这里.我用这个错误搜索了2天,说实话我不知道该怎么办!也许对WSDL和肥皂水有更深了解的人可以提供帮助.

I am really stuck here. I have googled this error for 2 days and honestly I do not know what to do! Maybe someone with a deeper understanding of WSDL and suds can help.

所以我的问题:

  • 这是我正在使用的正确定义的WSDL吗? (如果定义正确,我将报告给肥皂水 维护者)

  • Is this WSDL, which I am consuming proper defined? (If it is proper defined, I will report it to the suds maintainers)

如果未正确定义此WSDL,是否有解决方法(例如 suds架构医生)在suds网站上修复它?

If this WSDL is not proper defined, is there a workaround (e.g. suds schema doctor) to fix it on suds site?

是否有我应该使用的替代Python库?

Is there a alternative Python library, which I should use?

推荐答案

Suds当前是Python中使用WSDL的最佳选择.不幸的是,WSDL本身是如此复杂,以至于很难加以利用.

Suds is currently the best choice for WSDL consumption in Python. Unfortunately WSDL itself is such a complex mess that making good out of it is difficult.

幸运的是,Suds具有广泛的日志记录功能,可用于调试问题,这是解决问题的第一步.这个先前的问题回答了如何启用它:

Luckily Suds come with extensive logging capabilities which you can use to debug the problem and this is the first step of solving it. This earlier question answers how to enable it:

如何输出什么是SUD产生/接收?

但是,要为类型错误提供完整的答案,将需要查看大量的日志记录输出和/或源代码,因此,我建议您以某种方式尝试缩小问题的范围.要使问题最终解决,可以使用示例(无效)模式和Python代码.

However, giving a complete answer for the type error would require seeing extensive logging output and/or source code, so I suggest you somehow try to narrow down the problem. To make the problem ultimately solvable a sample (non-working) schema and Python code would be nice.

(该错误可能表明存在某些子模式/已定义的外部架构/缺少Suds出于X原因无法加载的子模式)

(The error might hint that there is some subschema / external schema defined / missing which Suds cannot load for reason X)

这篇关于suds抛出错误“类型未找到",消耗SOAP服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆