SUFI无法解析新的wsdl

2024-09-27 19:24:18 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个Python脚本,它使用suds0.4.1-3.el6通过SOAP接口与一些第三方软件协同工作。在

在软件更新之前一切都正常。现在所有的脚本都像:

#!/usr/bin/python
# -*- coding: UTF-8 -*-
#

import logging
from suds import WebFault
from suds.client import Client

logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)

client = Client("http://localhost:80/admin/soap/api3.wsdl")
#print client.location
#client.location = 'http://localhost:34012/'

print client

结尾为:

^{pr2}$

软件支持人员说“我们的WSDL文件很好,请咨询suds开发人员”,所以我需要帮助来调查这个问题。在

以前的工作文件:
https://dl.dropbox.com/u/4299326/py/20130225.wsdl/old/api3.wsdl
https://dl.dropbox.com/u/4299326/py/20130225.wsdl/old/encoding.xml

新的崩溃文件:
https://dl.dropbox.com/u/4299326/py/20130225.wsdl/new/api3.wsdl
https://dl.dropbox.com/u/4299326/py/20130225.wsdl/new/encoding.xml


Tags: frompyhttpsimport脚本comclient软件
1条回答
网友
1楼 · 发布于 2024-09-27 19:24:18

Software support said "our WSDL file is fine, ask suds developer"

我认为这不对。suds显示的Type not found: '(soapDiscountAddons, http://www.w3.org/2001/XMLSchema, )'消息是正确的。在

通过查看您的WSDL,soapDiscountAddons位于urn:api3命名空间中,因此在使用它时需要提到这一点。问题在于:

<!  operation response element  >
<element name="getDiscountAddonsResponse">
  <complexType>
    <sequence>
      <element name="ret" type="soapDiscountAddons" minOccurs="1" maxOccurs="unbounded"/>
    </sequence>
  </complexType>
</element>
<!  operation request element  >
<element name="insupdDiscountAddon">
  <complexType>
    <sequence>
      <element name="val" type="soapDiscountAddons" minOccurs="1" maxOccurs="1"/>
    </sequence>
  </complexType>
</element>

因为您没有给类型加前缀,所以使用了当前的名称空间http://www.w3.org/2001/XMLSchema,而不是{}。suds并没有寻找类型为soapDiscountAddons@urn:api3的地方,而是试图找到一个当然不存在的soapDiscountAddons@http://www.w3.org/2001/XMLSchema元素。在

这应该可以修复它:

^{pr2}$

相关问题 更多 >

    热门问题