Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/354.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Python/Suds调用名称中带有点的SOAP方法_Python_Soap_Suds - Fatal编程技术网

使用Python/Suds调用名称中带有点的SOAP方法

使用Python/Suds调用名称中带有点的SOAP方法,python,soap,suds,Python,Soap,Suds,正在尝试使用Python sud进行SOAP调用。它可以很好地导入WSDL,并且它生成的客户端看起来格式良好,但是我无法访问这些方法 方法调用的描述如下所示: client.service.Company.GetQueue() 但我从每一个变化中得到的是: suds.MethodNotFound:方法未找到 发现: 'OmnitureWebService.OmnitureWebService.Company' 下面是我创建的客户端的变量转储。你可以看到方法在那里,但是我如何访问它们呢?我尝试过指

正在尝试使用Python sud进行SOAP调用。它可以很好地导入WSDL,并且它生成的客户端看起来格式良好,但是我无法访问这些方法

方法调用的描述如下所示:

client.service.Company.GetQueue()

但我从每一个变化中得到的是:

suds.MethodNotFound:方法未找到 发现: 'OmnitureWebService.OmnitureWebService.Company'

下面是我创建的客户端的变量转储。你可以看到方法在那里,但是我如何访问它们呢?我尝试过指定端口,指定前缀,但似乎没有任何效果。谢谢你在这方面的帮助

> obj._ServiceSelector__client =  Suds (
> https://fedorahosted.org/suds/ ) 
> version: 0.4 GA  build: R699-20100913
> 
> Service ( OmnitureWebService )
> tns="http://www.omniture.com/"   
> Prefixes (2)
>       ns0 = "http://schemas.xmlsoap.org/soap/encoding/"
>       ns1 = "http://www.omniture.com/"    Ports (1):
>       (OmnitureWebServicePort)
>          Methods (173):
>             CodeManager.DeleteCodeArchive(xs:int
> archive_id, )
>             CodeManager.GenerateCode(xs:string
> char_set, xs:string code_type, xs:int
> cookie_domain_periods, xs:string
> currency_code, xs:string rsid, xs:int
> secure, )
>             CodeManager.GetCodeArchives(int_array
> archive_id_list, xs:string
> binary_encoding, xs:int
> populate_code_items, )
>             CodeManager.SaveCodeArchive(xs:string
> archive_description, xs:int
> archive_id, xs:string archive_name,
> code_items code, )
>             Company.CancelQueueItem(xs:int qid, )
>             Company.DownloadProduct(productType
> productType, )
>             Company.GetEndpoint(xs:string company,
> )
>             Company.GetQueue()
>             Company.GetReportSuites(string_array
> rs_types, xs:string sp, )
>             Company.GetTokenCount()
>             Company.GetTokenUsage()
>             Company.GetTrackingServer(xs:string
> rsid, )
>             Company.ResetTokenCount(xs:string
> auth_key, )
啊哈。它看起来像是命名空间中的“.”,这在XML中是正确的,但与肥皂水有关。我尝试过删除,但是Suds也会缓存WSDL。以下是如何逃脱:


页面下方是如何关闭缓存。

kfed是正确的,是点实现了这一点。但是我不想改变我的WSDL

但是,我发现了这个解决方法:
使用getattr以字符串引用方法名称,获取该方法的句柄,然后调用它:

Company_GetTokenCount = getattr(client.service, 'Company.GetTokenCount')
Company_GetTokenCount()


Me:Suds版本0.4 GA版本:R699-20100913。我已经试着这么做了好几天了。很好的发现,谢谢你的帮助posting@JiminyCricket谢谢我希望kfed接受这个答案。我不确定是否有更好的方法不用编辑WSDL就可以做到这一点。