Array

ApocXP

New member
Joined
May 8, 2003
Messages
1
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:
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!
 
I presume you are testing in Internet explorer.

This message is usually caused by the "Show friendly HTTP error messages" setting of Internet Explorer, which may override the display of context-specific error information provided.

Common error causes include invoking administrative functions, or entering a mistyped license key. Once the "Show friendly HTTP error messages" option is disabled (Tools/Internet Options... menu, Advanced tab) you should see more detailed error information.

Hope this will help
 
Back
Top