-
大小: 264KB文件類型: .rar金幣: 2下載: 0 次發布日期: 2021-06-12
- 語言: Java
- 標簽: java??webservice??天氣預報??
資源簡介
本資源引用于http://download.csdn.net/source/1156344
我做了下改動,大家分享一下。
webService服務地址:
http://www.webxml.com.cn/WebServices/WeatherWebService.asmx
private static String getSoapRequest1(String city) {
try {
InputStreamReader isr = new InputStreamReader(new FileInputStream(
"WebRoot/weather.xml"));
BufferedReader reader = new BufferedReader(isr);
StringBuffer soap = new StringBuffer("");
String tmp;
while ((tmp = reader.readLine()) != null) {
soap =soap.append(tmp);
}
reader.close();
isr.close();
return soap.toString().replace("${city}$", city);
} catch (Exception ex) {
ex.printStackTrace();
return null;
}
}

代碼片段和文件信息
package?com.huawei.servlet;
import?java.io.IOException;
import?javax.servlet.ServletException;
import?javax.servlet.http.HttpServlet;
import?javax.servlet.http.HttpServletRequest;
import?javax.servlet.http.HttpServletResponse;
import?com.huawei.util.WeatherReport;
public?class?WeatherServlet?extends?HttpServlet?{
private?static?final?long?serialVersionUID?=?1L;
public?void?doGet(HttpServletRequest?request?HttpServletResponse?response)
throws?ServletException?IOException?{
request.setCharacterEncoding(“UTF-8“);
String?city?=?request.getParameter(“city“);
String?info?=?WeatherReport.getWeather(city);
request.setAttribute(“info“?info);
request.getRequestDispatcher(“/index.jsp“).forward(request
response);
}
public?void?doPost(HttpServletRequest?request?HttpServletResponse?response)
throws?ServletException?IOException?{
this.doGet(request?response);
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????362??2009-03-27?16:58??weather\.classpath
?????文件????????295??2010-01-26?22:02??weather\.myme
?????文件???????1413??2009-03-27?21:44??weather\.project
?????文件????????406??2009-03-27?16:58??weather\.settings\.jsdtscope
?????文件???????1040??2009-03-27?21:45??weather\.settings\com.genuitec.eclipse.j2eedt.core.prefs
?????文件????????162??2009-03-27?21:45??weather\.settings\org.eclipse.jdt.ui.prefs
?????文件?????????49??2009-03-27?16:58??weather\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件??????????6??2009-03-27?16:58??weather\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????文件????????667??2009-03-27?21:45??weather\.settings\org.eclipse.wst.validation.prefs
?????文件???????3527??2010-01-26?23:25??weather\src\com\huawei\util\WeatherReport.java
?????文件????????928??2010-01-26?23:15??weather\src\com\huawei\servlet\WeatherServlet.java
?????文件???????7987??2010-01-26?23:11??weather\WebRoot\index.jsp
?????文件?????????39??2009-03-27?16:58??weather\WebRoot\me
?????文件????????460??2009-03-27?16:59??weather\WebRoot\tqimgs\0.gif
?????文件????????458??2009-03-27?16:59??weather\WebRoot\tqimgs\1.gif
?????文件????????404??2009-03-27?16:59??weather\WebRoot\tqimgs\10.gif
?????文件????????453??2009-03-27?16:59??weather\WebRoot\tqimgs\11.gif
?????文件????????460??2009-03-27?16:59??weather\WebRoot\tqimgs\12.gif
?????文件????????450??2009-03-27?16:59??weather\WebRoot\tqimgs\13.gif
?????文件????????440??2009-03-27?16:59??weather\WebRoot\tqimgs\14.gif
?????文件????????436??2009-03-27?16:59??weather\WebRoot\tqimgs\15.gif
?????文件????????453??2009-03-27?16:59??weather\WebRoot\tqimgs\16.gif
?????文件????????458??2009-03-27?16:59??weather\WebRoot\tqimgs\17.gif
?????文件????????366??2009-03-27?16:59??weather\WebRoot\tqimgs\18.gif
?????文件????????438??2009-03-27?16:59??weather\WebRoot\tqimgs\19.gif
?????文件????????420??2009-03-27?16:59??weather\WebRoot\tqimgs\2.gif
?????文件????????451??2009-03-27?16:59??weather\WebRoot\tqimgs\20.gif
?????文件????????434??2009-03-27?16:59??weather\WebRoot\tqimgs\21.gif
?????文件????????441??2009-03-27?16:59??weather\WebRoot\tqimgs\22.gif
?????文件????????459??2009-03-27?16:59??weather\WebRoot\tqimgs\23.gif
............此處省略123個文件信息
評論
共有 條評論