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,070 points
761 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 by Nymeria
• 3,520 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
74 views
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 in Python by Mohammad
• 3,170 points
48 views
+1 vote
0 answers

Sum the values of column matching and not matching from a .txt file and write output to a two different files using Python

Name                                                    value DR_CNDAOFSZAPZP_GPFS_VOL.0 139264 DR_CNDAOFSZAPZP_GPFS_VOL.1 15657 DR_CNDAOFSZAPZP_GPFS_VOL.0 139264 DR_CNDAOFSZAPZP_GPFS_VOL.1 156579 DR_CNDAOFSZAPZP_GPFS_VOL.2 156579 DR_CNDAOFSZAPZP_GPFS_VOL.3 ...READ MORE

Nov 20 in Python by Sagar
• 130 points
102 views
+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 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 409 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,520 points

edited Dec 19, 2018 by Nymeria 16,129 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,520 points
100 views