[英]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.