Im writing an XML Web Service that will grab weather info from weather.com. Simple enough. Its supposed to scrape the data from the page and return the WeatherInfo class to the user. But when I test the web service, I get a "Page Cannot be displayed HTTP 500 - Internal Server Error" error.
The service compiles fine . Heres the class:
Heres the code that I use to populate the WeatherInfo class:
If you need to look at any other code, please let me know. Thanks in advance!
The service compiles fine . Heres the class:
Code:
Public class WeatherInfo
<XmlElement("IconIndex")> Public iconIndex as string
<XmlElement("CurrentTemp")> Public currentTemp as string
<XmlElement("CurrentSkies")> Public currentSkies as string
<XmlElement("FeelsLike")> Public feelsLike as string
<XmlElement("UVIndex")> Public uvIndex as string
<XmlElement("DewPoint")> Public dewPoint as string
<XmlElement("Humidity")> Public humidity as string
<XmlElement("Visibility")> Public visibility as string
<XmlElement("Pressure")> Public pressure as string
<XmlElement("Wind")> Public wind as string
<XmlArray("Week"),XmlArrayItem("day", GetType(myday))> Public day() as myday
end class
Public Class myday
<XmlAttribute("id")> Public id as integer
<XmlElement("Icon")> Public icon as string
<XmlElement("Date")> Public number as string
<XmlElement("Forecast")> Public forecast as string
<XmlElement("Temps")> Public temps as string
<XmlElement("Precipitation")> Public precip as string
end class
Heres the code that I use to populate the WeatherInfo class:
Code:
Dim re as new RegEx(strWeatherSummary, RegEXOptions.IgnoreCase)
Dim myMatch as Match = re.Match(strRequestedHTML)
Dim objWeather as New WeatherInfo
objWeather.iconIndex = myMatch.Groups("strIconIndex").value
objWeather.currentTemp = myMatch.Groups("strCurrTemp").value
objWeather.currentSkies = myMatch.Groups("strCurrentSkies").value
objWeather.feelslike = myMatch.Groups("strFeelsLike").value
objWeather.uvIndex = myMatch.Groups("strUV").value
objWeather.dewPoint = myMatch.Groups("strDew").value
objWeather.humidity = myMatch.Groups("strHumid").value
objWeather.visibility = myMatch.Groups("strVisibility").value
objWeather.pressure = myMatch.Groups("strPressure").value
objWeather.wind = myMatch.Groups("strWind").value
The code above works without a problem.
objWeather.day(0).id = 1 Yep, the only integer in the class
objWeather.day(0).icon = "28" Im returning this as a string on purpose
objWeather.day(0).number = "Apr 5 03"
objWeather.day(0).forecast = "Rain"
objWeather.day(0).temps = "767" Im returning this as a string on purpose
objWeather.day(0).precip = "7" Im returning this as a string on purpose
If you need to look at any other code, please let me know. Thanks in advance!