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