使用 python suds 访问 WSDL-Service 时出现问题引发 TypeNotFound: ArrayOfint

发布于 2024-09-24 11:21:49 字数 665 浏览 3 评论 0原文

未找到类型:'(ArrayOfint,http://schemas.microsoft.com/2003/ 10/序列化/数组, )' 是肥皂水解析器产生的。 在...2003/10/Serialization/Arrays中定义了ArrayOfInt,所以我猜linux的大小写敏感性是问题所在。 知道如何解决这个问题吗?

from suds.client import Client
c = Client("https://developer-api.affili.net/V2.0/Logon.svc?wsdl")

一个

Type not found: '(ArrayOfint, http://schemas.microsoft.com/2003/10/Serialization/Arrays, )'

自从几天后我就不再去那里了,但我却得到了

TypeNotFound: Type not found: '(Logon, http://affilinet.framework.webservices/types, )'

Type not found: '(ArrayOfint, http://schemas.microsoft.com/2003/10/Serialization/Arrays, )'
is what suds resolver raises.
In ...2003/10/Serialization/Arrays ArrayOfInt is defined, so I guess linux' case sensitivity is the problem.
Any Idea how I can get around that?

from suds.client import Client
c = Client("https://developer-api.affili.net/V2.0/Logon.svc?wsdl")

used to return

Type not found: '(ArrayOfint, http://schemas.microsoft.com/2003/10/Serialization/Arrays, )'

now since a few days I don't even get there anymore but instead I get a

TypeNotFound: Type not found: '(Logon, http://affilinet.framework.webservices/types, )'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夏见 2024-10-01 11:22:00

听起来您的 WSDL 损坏了。您需要在此处使用提供的 ImportDoctor由 SUDS 提供。您需要使用它来帮助 Client 构造函数使用 http://schemas.microsoft.com/2003/10/Serialization/Arrays< 中找到的 ArrayOfint 类型/代码>。

我过去曾使用其他服务完成此操作,但没有看到您的 WSDL 或代码,这只是我对如何修复它的最佳猜测,因为我无法自己测试它:

from suds.client import Client
from suds.xsd.doctor import Import, ImportDoctor

# Obviously I made this up    
wsdl_url = 'http://whatever/path/to/wsdl'

# Fix missing types with ImportDoctor
schema_url = 'http://schemas.microsoft.com/2003/10/Serialization/Arrays'
schema_import = Import(schema_url)
schema_doctor = ImportDoctor(schema_import)

# Pass doctor to Client
client = Client(url=wsdl_url, doctor=schema_doctor)

值得注意的一件事是 URL < a href="http://schemas.microsoft.com/2003/10/Serialization/Arrays" rel="noreferrer">http://schemas.microsoft.com/2003/10/Serialization/Arrays 是甚至无效(它返回 404),所以我真的不确定这是正确的 URL。尽管我有信心至少引导你走向正确的方向。

编辑以回应您最近的评论 (2010-10-05):

使用您提供的 URL https://developer-api.affili.net/V2.0/Logon.svc ?wsdl 我能够成功创建客户端。我必须使用 ImportDoctor 因为它引发了以下错误:

TypeNotFound: Type not found: '(Logon, http://affilinet.framework.webservices/types, )'

因此我使用了以下代码并且能够获得成功的客户端对象:

from suds.client import Client
from suds.xsd.doctor import Import, ImportDoctor

wsdl_url = 'https://developer-api.affili.net/V2.0/Logon.svc?wsdl'

schema_url = 'http://affilinet.framework.webservices/types'
schema_import = Import(schema_url)
schema_doctor = ImportDoctor(schema_import)

client = Client(url=wsdl_url, doctor=schema_doctor)

打印客户端对象会显示以下内容:

Suds ( https://fedorahosted.org/suds/ ) 版本:0.3.9 GA 版本:R659-20100219

Service ( Authentication ) tns="http://affilinet.framework.webservices/Svc"
   Prefixes (5)
      ns0 = "http://affilinet.framework.webservices/types"
      ns1 = "http://schemas.datacontract.org/2004/07/Microsoft.Practices.EnterpriseLibrary.Validation.Integration.WCF"
      ns2 = "http://schemas.microsoft.com/2003/10/Serialization/"
      ns3 = "http://schemas.microsoft.com/2003/10/Serialization/Arrays"
      ns4 = "http://www.microsoft.com/practices/EnterpriseLibrary/2007/01/wcf/validation"
   Ports (1):
      (DefaultEndpointLogon)
         Methods (2):
            GetIdentifierExpiration(xs:string CredentialToken, )
            Logon(xs:string Username, xs:string Password, ns0:WebServiceTypes WebServiceType, ns0:TokenDeveloperDetails DeveloperSettings, ns0:TokenApplicationDetails ApplicationSettings, )
         Types (12):
            ns3:ArrayOfKeyValueOfstringstring
            ns1:ArrayOfValidationDetail
            ns0:Logon
            ns0:TokenApplicationDetails
            ns0:TokenDeveloperDetails
            ns1:ValidationDetail
            ns4:ValidationFault
            ns0:WebServiceTypes
            ns0:affilinetWebserviceFault
            ns2:char
            ns2:duration
            ns2:guid

在您可以使用 之前client.service.Logon() 您必须满足该方法所需的类型签名。您必须使用 client.factory.create() 创建各种类型对象(例如 client.factory.create('ns0:WebServiceTypes'))并传递这些对象以及您的用户名/密码。

Sounds like you have a broken WSDL. This is where you'll need to use the ImportDoctor provided by SUDS. You need use this to help the Client constructor use the ArrayOfint type found at http://schemas.microsoft.com/2003/10/Serialization/Arrays.

I have done this in the past with other services but without seeing your WSDL or your code, this is only my best guess as to how you may fix it because I can't test it myself:

from suds.client import Client
from suds.xsd.doctor import Import, ImportDoctor

# Obviously I made this up    
wsdl_url = 'http://whatever/path/to/wsdl'

# Fix missing types with ImportDoctor
schema_url = 'http://schemas.microsoft.com/2003/10/Serialization/Arrays'
schema_import = Import(schema_url)
schema_doctor = ImportDoctor(schema_import)

# Pass doctor to Client
client = Client(url=wsdl_url, doctor=schema_doctor)

One thing worth noting is that the URL http://schemas.microsoft.com/2003/10/Serialization/Arrays is not even valid (it returns a 404), so I am really not sure that is the right URL. Although I am confident that I am at least steering you in the right direction.

Edit in response to your recent comment (2010-10-05):

Using the URL you provided of https://developer-api.affili.net/V2.0/Logon.svc?wsdl I was able to successfully create a client. I had to use an ImportDoctor because it raised the following error:

TypeNotFound: Type not found: '(Logon, http://affilinet.framework.webservices/types, )'

So I used the following code and was able to get a successful client object:

from suds.client import Client
from suds.xsd.doctor import Import, ImportDoctor

wsdl_url = 'https://developer-api.affili.net/V2.0/Logon.svc?wsdl'

schema_url = 'http://affilinet.framework.webservices/types'
schema_import = Import(schema_url)
schema_doctor = ImportDoctor(schema_import)

client = Client(url=wsdl_url, doctor=schema_doctor)

Printing the client object displays this:

Suds ( https://fedorahosted.org/suds/ ) version: 0.3.9 GA build: R659-20100219

Service ( Authentication ) tns="http://affilinet.framework.webservices/Svc"
   Prefixes (5)
      ns0 = "http://affilinet.framework.webservices/types"
      ns1 = "http://schemas.datacontract.org/2004/07/Microsoft.Practices.EnterpriseLibrary.Validation.Integration.WCF"
      ns2 = "http://schemas.microsoft.com/2003/10/Serialization/"
      ns3 = "http://schemas.microsoft.com/2003/10/Serialization/Arrays"
      ns4 = "http://www.microsoft.com/practices/EnterpriseLibrary/2007/01/wcf/validation"
   Ports (1):
      (DefaultEndpointLogon)
         Methods (2):
            GetIdentifierExpiration(xs:string CredentialToken, )
            Logon(xs:string Username, xs:string Password, ns0:WebServiceTypes WebServiceType, ns0:TokenDeveloperDetails DeveloperSettings, ns0:TokenApplicationDetails ApplicationSettings, )
         Types (12):
            ns3:ArrayOfKeyValueOfstringstring
            ns1:ArrayOfValidationDetail
            ns0:Logon
            ns0:TokenApplicationDetails
            ns0:TokenDeveloperDetails
            ns1:ValidationDetail
            ns4:ValidationFault
            ns0:WebServiceTypes
            ns0:affilinetWebserviceFault
            ns2:char
            ns2:duration
            ns2:guid

Before you can use client.service.Logon() you're going to have to satisfy the type signature required by that method. You'll have to create various type objects using client.factory.create() (e.g. client.factory.create('ns0:WebServiceTypes')) and pass those objects along with your username/password.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文