[英]Is it possible to use python suds to read a wsdl file from the file system?
From suds documentation , I can create a Client
if I have a url for the WSDL.从 suds文档中,如果我有 WSDL 的 url,我可以创建一个
Client
。
from suds.client import Client
url = 'http://localhost:7080/webservices/WebServiceTestBean?wsdl'
client = Client(url)
I currently have the WSDL file on my file system.我的文件系统上目前有 WSDL 文件。 Is it possible to use suds to read the WSDL file from my file system instead of hosting it on a web server?
是否可以使用 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")))
This is a more complete one liner that will:这是一个更完整的单衬,它将:
Based upon:基于:
# Python 2 (Legacy Python)
import urlparse, urllib, os
url = urlparse.urljoin('file:', urllib.pathname2url(os.path.abspath("service.xml")))
Using pathlib:使用路径库:
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.