java编写一个webservice接口,接口中的方法参数应该是什么,返回值呢?(急)要求见补充,谢谢啦
private JaxWsProxyFactoryBean getProxyFactory(Class<> clazz,String address){
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factorysetServiceClass(clazz);
factorysetAddress(address);
return factory;
}
public void save(){
JaxWsProxyFactoryBean factory = getProxyFactory(ProgramVerWebServiceclass, PROGRAM_VER_WEB_SERVICE_ADDRESS);
ProgramVerWebService service = (ProgramVerWebService)factorycreate();
String result = servicegetEmpByAccount("abc");
Systemoutprintln(result);
}
本地建立接口,如ProgramVerWebService,然后建立factory调用即可,这里用的是cxf
也可以用axis2通过解析wsdl文件来直接生成本地代码,调用如下:
ProgramVerWebServiceImplServiceStub stub = new ProgramVerWebServiceImplServiceStub();
GetEmpByAccountE e = new GetEmpByAccountE();
GetEmpByAccount request = new GetEmpByAccount();
requestsetArg0("abc");
esetGetEmpByAccount(request);
String result = stubgetEmpByAccount(e)getGetEmpByAccountResponse()get_return();
Systemoutprintln(result);
0条评论