|
楼主 |
发表于 2020-9-7 17:11:25
|
显示全部楼层
String businessServer = "http://120.79.101.150:8080/BusinessServer";
String loginName = "system";
String password = "123456";
// 获得本地IP地址
String localIP = "120.79.101.150";
// 初始化动作引擎
ActionEngine.init(businessServer);
// 登录
String bSessionID = ActionEngine.login(loginName, ActionUtils.md5(password), localIP, null);
try {
Action action = new Action();
// 指定动作的process、activity和action,这里要注意登录的用户应该有执行这个功能中的这个动作的权限
action.setProcess("/actionDemo/actionDemo/process/bizClient/bizClientProcess");
action.setActivity("mainActivity");
action.setName("demo");
// 调用动作
ActionResult actionResult = ActionEngine.invokeAction(action, ActionUtils.JSON_CONTENT_TYPE, bSessionID, null, null);
// 判断是否调用成功
if (actionResult.isSuccess()){
// 返回值
if(actionResult.getDatas() != null && actionResult.getDatas().size()>0 && actionResult.getDatas().get(0) != null){
String a = actionResult.getDatas().get(0).toString();
System.out.println("================"+a);
}
}else{
throw new RuntimeException(actionResult.getMessage());
}
} finally {
// 要保证注销,否则会占用在线人数
ActionEngine.logout(bSessionID);
} |
|