日期:2014-05-17 浏览次数:20864 次
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
Client client = new Client(new URL("http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl"));
Object[] results = client.invoke("getSupportCityString",new Integer[]{3113});
System.out.println(results[0]);
Document document = (Document) results[0];
System.out.println(document.getFirstChild());
NodeList l1 =document.getElementsByTagName("string");
for (int i = 0; i < l1.getLength(); i++) {
NodeList n2 = l1.item(i).getChildNodes();
for (int j = 0; j < n2.getLength(); j++) {
System.out.println(n2.item(i).getTextContent());
}
}
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}