金蝶 EAS WebService 使用 IntelliJ IDEA 调用
1. 第一步,访问 http://server-ip:port/ormrpc/services 地址,下载 .wsdl文件。(右键点击 .wsdl 另存为)
2. 第二步,打开 IntelliJ IDEA 创建 web 项目,并引入相关 jar 包
3. 第三步,将下载下来的 .wsdl 复制项目根路径下,并看图操作
4. 第四步,填写。Username:你的用户名,Password:你的密码,Package prefix:发布的包路径。点击OK,就会生成左边 6 个文件
5. 第五步,创建测试类,并调用登录方法
代码如下 。
login()方法:
参数1:username:你的用户名。
参数2:password:你的密码。
参数3:固定值:eas。
参数4:客户端登录的数据中心名称。
参数5:固定值:L2。
参数6:固定值:1。
public class TestMain{
public static void main(String[] args) throws ServiceException, RemoteException {
login();
}
public static String login() throws ServiceException, RemoteException {
EASLoginProxyServiceLocator locator = new EASLoginProxyServiceLocator();
EASLoginProxy login = locator.getEASLogin();
WSContext context = login.login("xxx", "xxx", "eas", "xxx", "L2", 1);
System.out.println("登录成功! Session ID : " + context.getSessionId());
return context.getSessionId();
}
{