1. Download the latest Axis2
Http://mirrors.hust.edu.cn/apache//axis/axis2/java/core/1.6.3/axis2-1.6.3-bin.zip
2. Unzip the switch to Bin using DOS, execute
Wsdl2java.bat-uri http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl
This is a weather forecast service written in. Net. SRC was generated later in the bin.
3. Copy the SRC code into a Java project and copy the jar from the Lib in axis to the project.
4. Create a new class, Test.java
PackageCn.com.webxml;Importcn.com.webxml.WeatherWebServiceStub.ArrayOfString;ImportCn.com.webxml.WeatherWebServiceStub.GetWeatherbyCityName; Public classTest { Public Static voidMain (string[] args)throwsexception{weatherwebservicestub stub=Newweatherwebservicestub (); Stub._getserviceclient (). GetOptions (). SetProperty (Org.apache.axis2.transport.http.HTTPConstants.CHUNKE D, Boolean.false); Getweatherbycityname City=NewGetweatherbycityname (); City.setthecityname (Shenzhen); Arrayofstring Array=Stub.getweatherbycityname (city). Getgetweatherbycitynameresult (); string[] Str=array.getstring (); for(String s:str) {System.out.println (s); } }}
5. Run test with the following results:
Guangdong
Shenzhen
59493
59493.jpg
2015-10-10 8:15:46
21℃/28℃
October 10 Cloudy
No continuous wind Breeze
1.gif
1.gif
Today's weather: temperature: 23 ℃; Wind/Wind: 2 Levels in the northeast, Humidity: 69%; Air quality: temporarily no; UV intensity: weak
Sunglasses index: not required. Daytime light is weak and no sunglasses are required.
Dressing index: Hot. Suitable for summer wear such as T-shirts and short coats.
Tourism index: suitable. Have rain, enjoy the fun of traveling in the rains to carry rain gear.
Movement Index: more unfavorable. There is precipitation, it is recommended that you indoor leisure sports.
Car Wash Index: not appropriate. Rain, rain and mud will stain your car.
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. The weather is cool, the humidity is big, easy cold.
Air Pollution index: not currently.
UV index: weak. The radiation is weak, rub spf12-15, pa+ skin care product.
Comfort Index: more comfortable. Rain in the daytime, some heat.
......
Java uses the. NET WebService