Is it possible to use python suds to read a wsdl file from the file system? Is it possible to use python suds to read a wsdl file from the file system? python python

Is it possible to use python suds to read a wsdl file from the file system?


try to use url='file:///path/to/file'


Oneliner

# Python 3import urllib, os url = urllib.parse.urljoin('file:', urllib.request.pathname2url(os.path.abspath("service.xml")))

This is a more complete one liner that will:

  • let you specify just the local path,
  • get you the absolute path,
  • and then format it as a file-url.

Based upon:

Original for reference

# Python 2 (Legacy Python)import urlparse, urllib, osurl = 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()