代码清单2: JAX-RPC客户端


1  import javax.xml.rpc.Stub;
2  import types.GetEmpSalary;
3  import types.GetEmpSalaryResponse;

4  
5  public class EmpClient {
6   public static void main(String[] args) {
7    GetEmpSalaryResponse response = null;
8    try {      
9     EmpInterface emp = (EmpInterface)    
 (new EmpService_Impl().getEmpPort());

10    response = emp.getEmpSalary(new GetEmpSalary("7369"));
11    System.out.println("Employee 7369's salary is 
" + response.getResult());
12   } catch (Exception ex) {
13      ex.printStackTrace();
14   }
15  }    
16 }

...
E-mail this page