Some examples on how to connect to the FEWS PI-XML SOAP Web Service:
Python
To get time series from FEWS using python the following example uses the requests module and reads the time series response as a
# Simple example that uses python to get timeSeries from the Delft-FEWS PI Soap Service. import requests import xml.etree.ElementTree as ET soapMessage = """<?xml version="1.0" ?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:few="http://fewspiservice.wldelft.nl"> <soapenv:Header/><soapenv:Body> <few:getTimeSeriesForFilter2> <few:startTime>2000-01-01T00:00:00Z</few:startTime> <few:endTime>2010-01-01T00:00:00Z</few:endTime> <few:locationIds>63306260000</few:locationIds> <few:parameterIds>T.obs.mean</few:parameterIds> </few:getTimeSeriesForFilter2> </soapenv:Body> </soapenv:Envelope>""" url = 'http://localhost:8080/FewsWebServices/fewspiservice' headers = { "Content-Type": "text/xml", "SOAPAction" : "\"\"" } response = requests.post(url=url, data=soapMessage, headers=headers) data = response.text xmlTree = ET.fromstring(data) piXmlResponse = None for elem in xmlTree.iter(): if elem.tag == 'return': piXmlResponse = elem.text if piXmlResponse is not None: print(piXmlResponse) # For further processing, the PI-XML response can be parsed as well. parsedPiXml = ET.fromstring(piXmlResponse) else: print('No pi xml response found')
To see an