Procedure for the client to call the weather forecast Web Service

Source: Internet
Author: User

1. Use xfire to get the http://www.webservicex.net/globalweather.asmx? The Web Service of the WSDL weather forecast generates the corresponding client program. For detailed steps, see" Xfire generate client programs based on WSDL" Http://blog.csdn.net/pengchua/archive/2007/08/02/1722156.aspx2. Write call Test. JavaPackage net. webservicex; import Java. util. properties; import Org. dom4j. documentexception; import XML. testxml; public class test {public static void main (string [] ARGs) {// todo auto-generated method stub globalweatherclient client = new globalweatherclient (); globalweathersoap globalweather = client. getglobalweathersoap (); // if it is a proxy server, you can add the following three statements to the properties prop = system. getproperties (); prop. put ("HTTP. proxyhost "," 17. q31.1. 46 "); prop. put ("HTTP. proxyport "," 8080 "); // system. out. println (globalweather. getcitiesbycountry ("China"); try {testxml. read (testxml. stringtodocument (globalweather. getweather ("Shanghai", "China");} catch (incluentexception e) {// todo auto-generated Catch Block E. printstacktrace () ;}} testxml. javar is used to parse XML. For specific code, see: Java Analysis XML Method _ Dom4j Http://blog.csdn.net/pengchua/archive/2007/08/23/1755441.aspx

 

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.