How to use read a WSDL file from the file system using Python suds?

0 votes

Hi all, so I was checking out the suds documentation. And from what I have learned until now, I am able to create my own client. That is if I have the URL for the WSDL is what I know.

Check out the below snippet:

from suds.client import Client
url = 'http://localhost:7080/webservices/WebServiceTestBean?wsdl'
client = Client(url)

Do note that I have the WSDL file on my file system now already.

My question is simple. Is it possible to make use of suds in this scenario to read the WSDL file from the native file system (mine) and avoid hosting it on a random web server?

All help appreciated!

Jan 21 in Python by Anirudh
• 2,050 points
214 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Hi, good question.

It is a very simple and straightforward answer, to be honest. Make sure you try to use the following as the URL parameter:

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

This will surely solve your query and you should be up and running quickly.

Here is another snippet of code:

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

This will basically let you specify the local path only and it will also get you the absolute path as well. Win-win.

Hope this helped!

answered Jan 21 by Nymeria
• 3,500 points

Related Questions In Python

0 votes
1 answer

How to read data from a text file using Python?

Refer to the below example where the ...READ MORE

answered May 12 in Python by Sushma
12 views
0 votes
1 answer

How to download a file over HTTP using Python?

In Python 2, use urllib2 which comes ...READ MORE

answered Oct 18, 2018 in Python by SDeb
• 10,860 points
20 views
0 votes
1 answer

how to read a JSON from a file?

You can use with statement with open('strings.json') as ...READ MORE

answered Oct 24, 2018 in Python by Priyaj
• 56,140 points
56 views
+1 vote
1 answer

How to read hdfs file using python?

subprocess.Popen(["hadoop", "fs", "-cat", "/path/to/myfile"], stdout ...READ MORE

answered Dec 6, 2018 in Python by Omkar
• 66,910 points
221 views
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
56 views
+4 votes
6 answers
0 votes
1 answer

How to get the return value from a thread using python?

You don't need to change your existing ...READ MORE

answered Dec 3, 2018 in Python by Nymeria
• 3,500 points

edited Dec 19, 2018 by Nymeria 5,125 views
0 votes
1 answer

How to create and read from a temporary file in Python?

Hi, there is a very simple solution ...READ MORE

answered Jan 29 in Python by Nymeria
• 3,500 points
28 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.