我正在使用suds库-python 2.7-我想从wsdl文件中获取所有方法的完整路径。 我使用此代码从wsdl文件中获取方法列表:
from suds.client import Client
url = "http://www.webservicex.net/country.asmx?WSDL"
client = Client(url)
list_of_methods = [method for method in client.wsdl.services[0].ports[0].methods]
我得到这样的东西:
[GetCurrencyCodeByCurrencyName, GetCurrencyByCountry, GetCurrencyCode, GetCountries, GetCurrencies, GetISOCountryCodeByCountyName, GetISD, GetCountryByCurrencyCode, GetGMTbyCountry, GetCountryByCountryCode]
但我想得到这样的东西:
[http://www.webserviceX.NET/GetCountryByCountryCode, ...]
所以,我该怎么做?
答案 0 :(得分:0)
如何使用端口的qname
属性?
from suds.client import Client
url = "http://www.webservicex.net/country.asmx?WSDL"
client = Client(url)
port = client.wsdl.services[0].ports[0]
list_of_methods = [port.qname[1] + '/' + method for method in port.methods]
print(list_of_methods)