Example Output for Weather Web Service

Listing 2. Calling a local wrapper service to retrieve a remote service's data using a client-side proxy class.

function GetWeather()
{
       XmlForAsp.WeatherService.GetWeatherReport($get("txtAirportCode").value,
    OnGetWeatherReturn);
}

function OnGetWeatherReturn(result)
{
    if (result != null && result.station != null)
    {
        $get("spanCity").innerHTML = result.station.name;
        var temp = 9/5 * (result.temperature.ambient + 32);
        $get("spanTemp").innerHTML = Math.round(temp) + " F";
        $get("spanHumidity").innerHTML = 
          result.temperature.relative_humidity;
        $get("spanWind").innerHTML = result.wind.string;
    }
    else
    {
        alert("Weather report not found for " + 
          $get("txtAirportCode").value);
    }
}