Learn how to create and use the WebService service, and apply it here to get weather data from the Web.
Find the free WebService service on the internet first,
As this site: http://www.webxml.com.cn/zh_cn/web_services.aspx
Save the Web page as a WSDL file, note that you can not use it directly, delete the contents of the <s:element ref= "S:schema"/> In the document, and delete it in a few places. Then you can generate the client code through the WSDL file, through the previous learning, you can use the JDK comes with the wsimport, or cxf Wsdl2java, or Eclipse generation WebService client function, I use Wsimport, Perform a similar command like this:
Wsimport-keep-p xx.xx.xx xxx.wsdl
The client code I generated is as follows:
Now it's time to test, and the test code is as follows:
The test results are as follows:
Code Address: Https://files.cnblogs.com/files/liunianfeiyu/weatherwebserviceclient.rar
Webserive Study record 4-Get the weather example