⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 weatherforecastservice.java

📁 ajax基础教程配套的例子源代码
💻 JAVA
字号:
package ajaxdashboard.service;import ajaxdashboard.ws.weatherforecast.WeatherData;import ajaxdashboard.ws.weatherforecast.WeatherForecast;import ajaxdashboard.ws.weatherforecast.WeatherForecastLocator;import ajaxdashboard.ws.weatherforecast.WeatherForecastSoap;import ajaxdashboard.ws.weatherforecast.WeatherForecasts;import java.text.SimpleDateFormat;import javax.xml.rpc.ServiceException;public class WeatherForecastService {    public WeatherForecasts getForecastFor(String zipCode) {        WeatherForecasts forecasts = null;        try {            forecasts = getWeatherForecastSoap().getWeatherByZipCode(zipCode);            WeatherData[] dataArray = forecasts.getDetails().getWeatherData();                        WeatherData data = null;            SimpleDateFormat parser = new SimpleDateFormat("EEEE, MMMM dd, yyyy");            SimpleDateFormat formatter = new SimpleDateFormat("EEE. MM/dd");            for(int i = 0; i < dataArray.length; i++) {                data = dataArray[i];                try {                    data.setDay(formatter.format(parser.parse(data.getDay())));                }                catch(Exception e) {                    System.out.println("\n\n\nParsing Exception: " + e);                }            }        }         catch(java.rmi.RemoteException ex) {            // TODO handle remote exception        }        return forecasts;    }    private WeatherForecastSoap getWeatherForecastSoap() {        WeatherForecastSoap weatherForecastSoap = null;        try {            weatherForecastSoap = new WeatherForecastLocator().getWeatherForecastSoap();        }         catch (ServiceException ex) {            ex.printStackTrace();        }                return weatherForecastSoap;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -