2014-09-26 65 views
0

例如,我在wsdl_url WSDL:python suds或sf-suds如何與「wsdl:import」一起使用?

<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(...) 
+0

https://bitbucket.org/jurko/suds/issue/19/add-support-for-importing-xsd-schemas – okuznetsov 2014-09-26 12:23:00

回答

1

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

創建客戶端後,打印它。你將不得不像下面的東西:

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

相關問題