Original page Http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx
View WSDL http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl
Java calls. NET-written services that require the use of the Wsimport tool to generate client-side code based on a WSDL file
And we need to make a little change .
In the browser, say WSDL source is saved as weather.wsdl
Put one of the
<s:element ref= "S:schema"/><s:any/>
Replace All
<s:any minoccurs= "2" maxoccurs= "2"/>
Then execute the wsimport command into the SRC directory of the project in CMD
Wsimport-keep E:\umgsai\workspace\weather_client\src\weather.wsdl
The following code is generated when you finish executing
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/4C/29/wKiom1Q3iWLyGBDYAAH1imyLmxU038.jpg "title=" Qq20141010152301.png "alt=" Wkiom1q3iwlygbdyaah1imylmxu038.jpg "/>
Client.java
public class Clienttest {public static void main (string[] args) {Weatherws Weatherws = new Weatherws (); Weatherwssoap Weatherwssoap = Weatherws.getweatherwssoap (); Arrayofstring weather = Weatherwssoap.getweather ("Wuhan", "5ade06102c1040fc95d89784bf428035"); list<string> String = weather.getstring (); System.out.println (string);}}
The results are as follows
[Hubei Wuhan, Wuhan, 1582, 2014/10/10 14:54:23, today's weather: temperature: 26 ℃; wind/Wind: North wind 2; Humidity: 46%, air quality: no; UV intensity: Strong, sunglasses index: very necessary. It is recommended to wear a 2-stage and UV400 shade mirror.
Dressing index: comfortable. It is recommended to wear long-sleeved shirts trousers and other clothing.
Tourism index: suitable. The weather is good, you can enjoy the scenery of nature.
Movement Index: more suitable. Outdoor Sports please pay attention to sun protection.
Car Wash Index: more appropriate. No rain and less wind, easy to maintain cleanliness.
Makeup index: Go oil. Please choose the dew cream to make the bottom, the water quality oil-free Foundation cream.
Cold index: more prone to hair. Large temperature difference, easy to catch cold, pay attention to protection.
Air Pollution index: not currently.
UV index: Strong. Coating SPF greater than 15, pa+ sunscreen skin care products.
Comfort Index: more comfortable. Sunny day, morning and evening cool, comfortable, hot afternoon.
, October 10 Cloudy, 15 ℃/27 ℃, no continuous wind breeze, 1.gif, 1.gif, October 11 Cloudy, 15 ℃/26 ℃, no continuous wind breeze, 1.gif, 1.gif, October 12 Cloudy, 14 ℃/25 ℃, no continuous wind breeze, 1.gif , 1.gif, October 13 Cloudy, 12 ℃/21 ℃, no continuous wind breeze, 1.gif, 1.gif, October 14 Cloudy, 13 ℃/23 ℃, no continuous wind breeze, 1.gif, 1.gif, October 15 Cloudy, 15 ℃/26 ℃, no continuous wind breeze , 1.gif, 1.gif, October 16 Cloudy, 15 ℃/25 ℃, no continuous wind breeze, 1.gif, 1.gif]
This article is from "Avatar" blog, please make sure to keep this source http://shamrock.blog.51cto.com/2079212/1562193
WebService study notes-read Weather service information for webxml.com.cn