簡體   English   中英

python suds或sf-suds如何與“ wsdl:import”一起使用?

[英]How python suds or sf-suds work with “wsdl:import”?

例如,我在wsdl_url有wsdl:

<wsdl:definitions ...>
   <wsdl:import namespace="wsdl/auth/v1/" location="wsdl/auth/v1/soap/auth.wsdl"/>
   <wsdl:import namespace="wsdl/core/v1/" location="wsdl/v1/soap/core.wsdl"/>
   ...
</wsdl>

如何從namespace="wsdl/auth/v1/"調用方法? auth.wsdl包含方法登錄。

import suds
client = suds.client.Client(wsdl_url)
client.service.login(...)

我找不到同時測試兩個名稱空間的服務,但邏輯似乎適用於此。

創建客戶端后,打印它。 您將看到以下內容:

url = "http://wsf.cdyne.com/WeatherWS/Weather.asmx?wsdl"
client = suds.client.Client(url)
print client

Suds ( https://fedorahosted.org/suds/ )  version: 0.4 GA  build: R699-20100913

Service ( Weather ) tns="http://ws.cdyne.com/WeatherWS/"
   Prefixes (1)
      ns0 = "http://ws.cdyne.com/WeatherWS/"
   Ports (2):
      (WeatherSoap)
         Methods (3):
            GetCityForecastByZIP(xs:string ZIP, )
            GetCityWeatherByZIP(xs:string ZIP, )
            GetWeatherInformation()
         Types (8):
            ....
      (WeatherSoap12)
         Methods (3):
            GetCityForecastByZIP(xs:string ZIP, )
            GetCityWeatherByZIP(xs:string ZIP, )
            GetWeatherInformation()
         Types (8):
            ....

然后,可以使用client.set_options(service='service1', port='port1') 之后,只需調用service.function。 在示例中:

client.set_options(port='WeatherSoap12')
client.service.GetWeatherInformation()

更多信息: https : //fedorahosted.org/suds/wiki/Documentation

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM