For more information about JDK installation and configuration, see other articles.
Step 01: select the latest eclipse version.
Step 02:
Get the URL of the corresponding WSDL released by Shanghai thinking set:
Http://www.webxml.com.cn/WebServices/WeatherWebService.asmx? WSDL
Step 03: file -- New -- Other
Select Web serviceclient
Click Next]
Click Browse and enter the WSDL
Click Finish to generate the following file directory:
Step 04 create test. Java
Enter the following code to test.
PackageWeathertest;
ImportJava. RMI. RemoteException;
ImportJavax. xml. rpc. serviceexception;
ImportCn.com. webxml. weatherwebservicelocator;
ImportCn.com. webxml. weatherwebservicesoap;
Public classWeathertest {
/**
*@ ParamARGs
*/
Public static voidMain (string [] ARGs ){
//TodoAuto-generated method stub
Stringthecityname = "Dezhou ";
Weatherwebservicesoap wwsopat;
Java. Lang. String [] city =Null;
Weatherwebservicelocatordmslocator =NewWeatherwebservicelocator ();
System.Out. Print ("test100000000000000000000000 \ n ");
Try{
Wwsopat = dmslocator. getweatherwebservicesoap ();
City = wwsopat. getweatherbycityname (thecityname );
}Catch(Serviceexception e ){
//TodoAuto-generated Catch Block
E. printstacktrace ();
}Catch(RemoteException e ){
//TodoAuto-generated Catch Block
E. printstacktrace ();
}
System.Out. Print ("test11111111111111111111111111 \ n ");
System.Out. Print ("Desc:" + city. tostring () + "\ n ");
}
}