从 wsdl 文件获取 Web 服务方法的完整路径
get the full path of web service's methods from wsdl file
我正在使用 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, ...]
那么,我该怎么做呢?
使用端口的 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)
我正在使用 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, ...]
那么,我该怎么做呢?
使用端口的 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)