# Example of calling several WaterOneFlow web service methods # Not required for the assignment, but informative from suds.client import Client # Create the inputs needed for the web service call wsdlURL = 'http://data.iutahepscor.org/loganriverwof/cuahsi_1_1.asmx?WSDL' networkCode = 'iutah' # Create a new object named "service" for calling the web service methods service = Client(wsdlURL).service # Get the list of Sites from the service # -------------------------------------- print 'Get the list of sites.' print '----------------------' sitesResult = service.GetSitesObject('') siteCount = len(sitesResult.site) print 'In the selected service there are ' + str(siteCount) + ' Sites.\n' for x in sitesResult.site: print(x.siteInfo.siteCode[0].value + ': ' + x.siteInfo.siteName) # Get SiteInfo for a selected Site # --------------------------------------- print '\nGet information about a selected site.' print '----------------------------------------' siteCode = 'LR_Mendon_AA' siteInfoResult = service.GetSiteInfoObject(networkCode + ':' + siteCode) siteName = siteInfoResult.site[0].siteInfo.siteName numSeries = len(siteInfoResult.site[0].seriesCatalog[0].series) print('At the ' + siteName + ' Site there are ' + str(numSeries) + ' measured variables.\n')