[英]Is it possible to use python suds to read a wsdl file from the file system?
從 suds文檔中,如果我有 WSDL 的 url,我可以創建一個Client
。
from suds.client import Client
url = 'http://localhost:7080/webservices/WebServiceTestBean?wsdl'
client = Client(url)
我的文件系統上目前有 WSDL 文件。 是否可以使用 suds 從我的文件系統讀取 WSDL 文件而不是將其托管在 Web 服務器上?
嘗試使用url='file:///path/to/file'
# Python 3
import urllib, os
url = urllib.parse.urljoin('file:', urllib.request.pathname2url(os.path.abspath("service.xml")))
這是一個更完整的單襯,它將:
基於:
# Python 2 (Legacy Python)
import urlparse, urllib, os
url = urlparse.urljoin('file:', urllib.pathname2url(os.path.abspath("service.xml")))
使用路徑庫:
def wsdl_uri():
import pathlib
return pathlib.Path(os.path.abspath("resources/your_definition.wsdl")).as_uri()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.