生成客户端
在Eclipse中生成webservice客户端代码,New---->Other---->Webservice---->Webservice Client,选择之前拷贝到eclipse中的wsdl路径点击finish。
客户端代码
测试案例
public static void main(String[] args) {
try {
// 通过WebService登录EAS
EASLoginProxyServiceLocator loginLocator = new EASLoginProxyServiceLocator();
EASLoginProxy loginProxy = loginLocator.getEASLogin();
System.out.println("------ 开始登录服务器 .... ");
WSContext context = loginProxy.login("user", "", "eas", "001", "L2", 0);
System.out.println("------ 登陆成功,SessionID:" + context.getSessionId());
// 通过Kmye WevService获取信息
WSEaiFacadeSrvProxyServiceLocator eaiFacadeSrvProxyServiceLocator = new WSEaiFacadeSrvProxyServiceLocator();
WSEaiFacadeSrvProxy eaiFacadeSrvProxy = eaiFacadeSrvProxyServiceLocator.getWSEaiFacade();
String data = "";
String synBaseData = eaiFacadeSrvProxy.synBaseData("供应商", data);
System.out.println(synBaseData);
} catch (ServiceException e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
}
}