不接受Python WSDL函数参数

时间:2012-08-11 21:31:21

标签: php python soap wsdl

我可以像这样在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中的函数参数?

1 个答案:

答案 0 :(得分:0)

您使用的是哪个库,

假设您正在使用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'})