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, 2019 in Python by Anirudh
• 2,090 points
8,381 views

1 answer to this question.

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, 2019 by Nymeria
• 3,560 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 13, 2019 in Python by Sushma
1,530 views
–1 vote
2 answers
0 votes
1 answer
0 votes
1 answer

How do you read from a file using file handling in python?

To read from a file you can ...READ MORE

answered Jul 30, 2019 in Python by Mohammad
• 3,230 points
1,200 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,466 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
4,127 views
0 votes
3 answers

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

FWIW, the multiprocessing module has a nice interface for ...READ MORE

answered Dec 15, 2020 in Python by Roshni
• 10,480 points
107,993 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, 2019 in Python by Nymeria
• 3,560 points
2,087 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP