I wrote a process that retrieved data from the National Weather Service web service. It was working nicely for several years until Valentines Day. Now the call keeps getting an empty response error. I've contacted the National Weather Service and they so far have not been able to provide any suggestions except to say they recently changed to https. I tried creating a new simple test project with a new reference to their https URL and I still get the empty response error. Can anyone suggest a solution?
I set a web reference to:
https://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl
Here's the code I am testing and it still fails with the empty response error:
private void cmdGo_Click(object sender, RoutedEventArgs e)
{
decimal nLatitude = (decimal)30.32;
decimal nLongitude = (decimal)-81.55;
DateTime dEndTime = DateTime.Now;
DateTime dStartTime = dEndTime.AddHours(-2);
XmlDocument oXmlDocument = GetXmlDocument(nLatitude, nLongitude, dStartTime, dEndTime);
}
private XmlDocument GetXmlDocument(decimal nLatitude, decimal nLongitude, DateTime dStartTime, DateTime dEndTime)
{
XmlDocument oXmlDocument = new XmlDocument();
try
{
gov.weather.graphical.ndfdXML oWebProxy = new gov.weather.graphical.ndfdXML();
gov.weather.graphical.productType oProductType = gov.weather.graphical.productType.timeseries;
gov.weather.graphical.unitType oUnitType = gov.weather.graphical.unitType.e;
gov.weather.graphical.weatherParametersType oWeatherParametersType = new gov.weather.graphical.weatherParametersType();
oWeatherParametersType.appt = true; // Apparent Temperature
oWeatherParametersType.icons = true; // Conditions Icons
oWeatherParametersType.dew = true; // Dew Point Temperature
oWeatherParametersType.maxt = true; // Daily Maximum Temperature
oWeatherParametersType.mint = true; // Daily Minimum Temperature - no response
oWeatherParametersType.pop12 = true; // 12 Hourly Probability of Precipitation
oWeatherParametersType.precipa_r = true; // Liquid Precipitation Amount
oWeatherParametersType.rh = true; // Relative Humidity
oWeatherParametersType.sky = true; // Cloud Cover Amount
oWeatherParametersType.snow = true; // Snow Amount
oWeatherParametersType.temp = true; // Temperature
oWeatherParametersType.wdir = true; // Wind Direction
oWeatherParametersType.wgust = true; // Wind Speed Gust
oWeatherParametersType.wspd = true; // Wind Speed
oWeatherParametersType.wwa = true; // Watches, Warnings, and Advisories
oWeatherParametersType.wx = true; // Weather Type, Coverage, and Intensity
string sXmlData = oWebProxy.NDFDgen(nLatitude, nLongitude, oProductType, dStartTime, dEndTime, oUnitType, oWeatherParametersType);
oXmlDocument.LoadXml(sXmlData);
}
catch (Exception e)
{
string sMessage = e.Message;
sMessage = "Error: " + sMessage;
}
return oXmlDocument;
}
For the c# web reference I changed ours from:
http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl
to:
https://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl
I had to change a few of the parameters for my call to "string" format but the xml it returned seemed to be in the same format as the other url I used.
Hope this helps.
My call is now:
ndfdXML.NDFDgenByDay(currentLoc.latitude, currentLoc.longitude, DateTime.Now, "7", "e", "12 hourly");
To get the 7 day in my area.