<%@ WebService Language="JScript" Class="clsWeather" %>
import System
import System.Web.Services
public
WebService(Namespace="http://www.fabrikam.com/webservices")
class clsWeather { WebMethod(Description="return the weather conditions for a city")
function getConditions(strCity : String) { var now = new Date();
switch (strCity.toUpperCase()) { case "LONDON":
if (now.getMonth() <= 6||now.getMonth() >=8){ return "overcast"
}
if (now.getMonth() == 7) { return "partly overcast"
}
break;
case "SEATTLE":
if (now.getMonth() == 6 && now.getDay()==4){ return "torrential rain"
}
else { return "rain"
}
break;
case "LA":
return "smoggy"
break;
case "PHOENIX":
return "hot"
break;
default:
return "partly cloudy with a chance of showers"
}
}
}
Show: