【问题标题】:python suds call magento api soap v1 Type Not Found Errorpython suds调用magento api soap v1类型未找到错误
【发布时间】:2013-11-29 09:37:07
【问题描述】:

环境:CentOS 6.4 64bit、Python 2.6.6、Magento 1.7、Magento Core API、Suds 0.4.1

Python 代码:

client = Client(http://   /figol/api/soap/?wsdl)
client.service.login('figol', 'figol123')

错误详情: TypeNotFound: 找不到类型: '(Array, http://schemas.xmlsoap.org/soap/encoding/, )

但是 PHP代码:

$client = new SoapClient(http://    /figol/api/soap/?wsdl);
$session = $client->login('figol', 'figol123');

完美运行。

我尝试了很多方法(SOAP suds and the dreaded schema Type Not Found error),但没有运气。 非常感谢任何帮助。 谢谢。

【问题讨论】:

    标签: python api magento soap suds


    【解决方案1】:

    不知道 PHP 是如何正常工作的,但我在 Python 中使用 suds 时遇到了同样的错误。这是由于损坏的 wsdl/xsd。见this post here。

    使用 suds 的“医生”module 解决了这个问题。这是我用来修补我用来连接 Magento api 的损坏的 wsdl 定义的代码

    from suds.client import Client
    from suds.xsd.doctor import ImportDoctor, Import
    
    imp = Import('http://schemas.xmlsoap.org/soap/encoding/')
    imp.filter.add('urn:Magento')
    d = ImportDoctor(imp)
    client = Client(self.url, doctor=d)
    

    【讨论】:

      猜你喜欢
      • 2012-08-30
      • 1970-01-01
      • 1970-01-01
      • 2012-12-26
      • 2014-03-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-30
      相关资源
      最近更新 更多