the following code is a simple python3 script which iterates through the found WSDL methods and tries each of the methods until one of them works.
from suds.client import Client
url = 'http://127.0.0.1:8000/?wsdl'
client = Client(url)
functions = [m for m in client.wsdl.services[0].ports[0].methods]
for function_name in functions:
try:
#from all the methods, only 1 of them serves for reading files
print(client.service.function_name("/tmp/hello.txt"))
print (function_name + " works")
except:
#method is not for reading files, so skip it
print (function_name + " skipped")
From all the methods, only 1 of them is designed to read file and I the goal of the script to find out which method does that.
So in my case, the method read_file works for reading files: client.service.read_file("/tmp/hello.txt"), but I need the script to find the method.
Thanks in advance.