java webservice

Now that he is a moderately cerebral disabled patient, he has lost his memory and everything. The bigger reason is that he is getting more and more lazy. No nonsense, let's watch it next time.

Open Eclipse (not My Eclipse) and create a new Java project;

 

 

2. After creating a new Java project, create a new Web Service Client in this project;

Create a new web service client

 

 

3. Enter the wsdl address provided by the Web Service server and click next;

 Enter the wsdl address

 

 

4. Select the package where the generated client code is stored;

Select target package

 

 

5. Create a new test class, the class example is as follows:

 

[java]  view plain copy  
 
  1. import java.rmi.RemoteException;  
  2.   
  3. publicclass Test {   
  4.   
  5.     /** 
  6.      * Use axis to call webservice instance 
  7.      * @param args 
  8.      */  
  9.     publicstaticvoid main(String[] args) {    
  10.           
  11.         try {  
  12.             //Replace with the corresponding proxy class  
  13.             QueryValidatorServicesProxy proxy = new QueryValidatorServicesProxy();  
  14.             proxy.setEndpoint( "WSDL address provided by web service" );  
  15.             //Replace to get the corresponding serice  
  16.             QueryValidatorServices service =  proxy.getQueryValidatorServices();  
  17.             //Call the method provided by the web service  
  18.             String result = service.querySingle("id5""******""XXXX""XX,XXXXXX");  
  19.               
  20.             System.out.println(result);  
  21.               
  22.         } catch (RemoteException e) {  
  23.             e.printStackTrace ();  
  24.         }  
  25.   
  26.     }  
  27.   
  28. }  

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326789710&siteId=291194637