2016-03-03 61 views
0

我試圖從Web服務(WSDL/SOAP)中調用方法,並且也想禁用證書驗證,因爲Python默認情況下會這樣做。我目前的Python版本是3.5.1如何在Python 3.5中調用Web服務(WSDL/SOAP)中的方法

+1

的可能重複[我怎樣才能使用WSDL(SOAP)的Web Python中的服務?(http://stackoverflow.com/questions/115316/how-can-i-consume-a-wsdl- soap-web-service-in-python) – Binke

+0

我已經通過提供的鏈接,但它並沒有解決我的問題。看起來代碼示例不支持我的python版本(v3.5)。 @Binke – Pradeep

回答

0

安裝了suds-jurko(在我使用Python 3.5的情況下,泡沫安裝失敗了)並寫下了下面的代碼。

from suds.client 
import Client import ssl 

#Override the default behaviour of the Python 3 for the certificate validation (though it is not recommended) 
ssl._create_default_https_context = ssl._create_unverified_context 
url = 'https://????.asmx?wsdl' 
client = Client(url) 
print(client.service.method_name(param))