Webserive Study record 4-Get the weather example

Source: Internet
Author: User
Tags wsdl

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.