private JaxWsProxyFactoryBean getProxyFactory(Class<?> clazz,String address){
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(clazz);
factory.setAddress(address);
return factory;
}
public void save(){
JaxWsProxyFactoryBean factory = getProxyFactory(ProgramVerWebService.class, PROGRAM_VER_WEB_SERVICE_ADDRESS);
ProgramVerWebService service = (ProgramVerWebService)factory.create();
String result = service.getEmpByAccount("abc");
System.out.println(result);
}
æ¬å°å»ºç«æ¥å£ï¼å¦ProgramVerWebServiceï¼ç¶å建ç«factoryè°ç¨å³å¯ï¼è¿éç¨çæ¯cxf
ä¹å¯ä»¥ç¨axis2éè¿è§£æwsdlæ件æ¥ç´æ¥çææ¬å°ä»£ç ï¼è°ç¨å¦ä¸ï¼
ProgramVerWebServiceImplServiceStub stub = new ProgramVerWebServiceImplServiceStub();
GetEmpByAccountE e = new GetEmpByAccountE();
GetEmpByAccount request = new GetEmpByAccount();
request.setArg0("abc");
e.setGetEmpByAccount(request);
String result = stub.getEmpByAccount(e).getGetEmpByAccountResponse().get_return();
System.out.println(result);
追é®è½ç»åºå®æ´ä»£ç åï¼ä¸å¡é»è¾å¯å¿½ç¥ï¼æ没åè¿webservice,å®å
¨ä¸æé¢