赞
踩
使用包jolt-1.0
import bea.jolt.JoltSession;
import bea.jolt.JoltSessionAttributes;
import bea.jolt.SessionException;
简单示例
JoltSession jsession;
JoltSessionAttributes sattr;
JoltRemoteService joltRemoteService;
JoltTransaction trans;
String userName = "Administrator";
String userPassword = null;
String appPassword = null;
String userRole = "joltadmin";
String sendStr = new String("用户ID|用户名称");
String returnStr;
sattr = new JoltSessionAttributes();
//建立目标连接地址
sattr.setString(sattr.APPADDRESS,"//192.68.68.118:8888");
//TimeOut时间
sattr.setInt(sattr.IDLETIMEOUT, 300);
//建立连接,初始化
jsession = new JoltSession(sattr,userName,userRole,userPassword,appPassword);
//连接服务ABCD
joltRemoteService = new JoltRemoteService("ABCD",jsession);
//发送数据
joltRemoteService.setString("STRING",sendStr);
joltRemoteService.call(null);
returnStr = joltRemoteService.getStringDef("STRING",null);
joltRemoteService.clear();
jsession.endSession();
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。