【问题标题】:Python WSDL function parameters are not accepted不接受 Python WSDL 函数参数
【发布时间】:2012-08-11 21:31:20
【问题描述】:

我可以像这样在 PHP 中向 SOAP 客户端发送函数参数(searchLinks 是方法名称):

$client = new SoapClient("https://linksearch.api.cj.com/wsdl/version2/linkSearchServiceV2.wsdl",   array('trace'=> true));
$results = $client->searchLinks(array("developerKey" => $developerKey,
                                             "token" => '',
                                         "websiteId" => $websiteId,
                                     "advertiserIds" => 'joined'));

如果我想在 Python 中做同样的事情,我该怎么做?这是目前的代码:

server=WSDL.Proxy(url)
results=server.searchLinks({'developerkey':dev_key,'token':'','websiteId':website_id,'advertiserIds':'joined'})

当我尝试运行这个 Python 脚本时,它会抛出错误。为什么它不像 PHP 那样采用函数参数?

【问题讨论】:

  • 你确定你在python版本中以正确的方式传递参数吗?是否应该在字典中传递所有参数?

标签: php python soap wsdl


【解决方案1】:

你使用的是哪个库,

假设您使用的是 SOAPpy,您可以这样做。

#!/usr/bin/python

import SOAPpy

url= 'https://linksearch.api.cj.com/wsdl/version2/linkSearchServiceV2.wsdl'
proxy = SOAPpy.WSDL.Proxy(url)
results=proxy.searchLinks({'developerkey': 'dev_key','token':'','websiteId': 'website_id','advertiserIds':'joined'})

【讨论】:

  • 我使用了同一个库 SOAPpy.WSDL 但仍然没有提示,这是怎么回事?你想看python代码吗
  • 使用 suds,我能够解决我的问题,我想知道为什么我们不应该加上 '' 引号。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-08-02
  • 1970-01-01
  • 1970-01-01
  • 2017-11-24
  • 1970-01-01
  • 2019-06-26
相关资源
最近更新 更多