導入Java . util . date;
導入Java . text . date format;
導入org . Apache . axis . client . call;
導入org . Apache . axis . client . service;
導入javax . XML . namespace . qname;
導入Java . lang . integer;
導入javax . XML . RPC . parameter mode;
公共類caClient {
公共靜態void main(String[] args) {
嘗試{
string endpoint = " http://localhost:8080/ca3/services/caSynrochnized?wsdl ";
//直接引用遠程wsdl文件。
//下面都是套路嗎?
Service Service = new Service();
Call Call =(Call)service . create Call();
call.setTargetEndpointAddress(端點);
call . setoperationname(" addUser ");//WSDL中描述的接口名稱
call.addParameter("用戶名",org . Apache . axis . encoding . xmltype . xsd _ DATE,
javax . XML . RPC . parameter mode . in);//接口的參數
call . set returntype(org . Apache . axis . encoding . xmltype . xsd _ STRING);//設置返回類型?
String temp = " tester
String result =(String)call . invoke(新對象[]{ temp });
//將參數傳遞給方法並調用方法。
System.out.println("結果是"+結果);
}
捕捉(異常e) {
system . err . println(e . tostring());
}
}
}