一、服务端
1.实例对象
package
cn.gov.luzhou.SiteServer.user.web.vo;
import java.io.File;
import java.io.Serializable;
import java.sql.Date;
import java.sql.Timestamp;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
public class SysUserVo implements Serializable {
private static final long serialVersionUID = 1L;
// ----------------------用户名及密码-------------------------//
private String userId;
private String userName;
private String userPwd;
// 密保问题
private String findPwdQue;
// 密保问题答案
private String findPwdQueAnswer;
// ----------------------个人基本情况-------------------------//
private String realName;
private File userPic; // 相片
private String userPicFileName; // 相片文件名
private String userPicContentType; // 相片类型
private String userSex; // 性别
private String userPID; // 身份证号
private String userBornAddress; // 出生地点
private Date userBirthDay; // 出生日期
private String userNat; // 民族
private String userPolity; // 政治面貌
private Date userJoinTeam; // 入党时间
private int userHight; // 身高
private String userIsMarry; // 婚姻状况
private String userHealthy; // 健康状况
// ----------------------个人简历-----------------------------//
private String userTitle; // 职务
private String userWorkLevel; // 工作级别
private String userWorkName; // 技术职称
private Date userWorkTime; // 任现职时间
private Date userStateWorkTime; // 参加工作时间
// ----------------------------受教育情况----------------------//
private String userXueLi; // 学历
private String userXueWei; // 学位
private String userXueWeiNumber; // 学位证号
private Date userBiYeDate; // 毕业时间
private String userBiyeNumber; // 毕业证号
private String userBiyeSchool; // 毕业学校
private String userStudyProject; // 所学专业
// ---------------------------------------联系方式-------------//
private String userPostAddress; // 通信地址
private String userPost; // 邮政编码
private String officeNum; // 办公电话
private String addressNum; // 住宅电话
private String phoneNum; // 手机号码1
private String phoneNum2; // 手机号码2
private String email;
private int displayLevel;
// ---------------------------其它字段------------------------------//
private String yl1;
private String yl2;
private String remark;
private Timestamp loginTime;
private String state;
// 拥有哪些角色
// private SysRole userRole;
private String roleId;
private String roleName;
// private SysDepartment userDanwei;//单位
private String unitId;
private String unitModel;
private String unitName;
// private SysDepartment department; //属于那一个部门
private String departmentId;
private String departmentModel;
private String departmentName;
// private SysRegion region;
private String regionId;
private String regionModel;
private String regionName;
// 排序
private String[] usersIds;
private String[] displayLevels;
public int getDisplayLevel() {
return displayLevel;
}
public void setDisplayLevel(int displayLevel) {
this.displayLevel = displayLevel;
}
public String[] getUsersIds() {
return usersIds;
}
public void setUsersIds(String[] usersIds) {
this.usersIds = usersIds;
}
public String[] getDisplayLevels() {
return displayLevels;
}
public void setDisplayLevels(String[] displayLevels) {
this.displayLevels = displayLevels;
}
public String getRegionId() {
return regionId;
}
public void setRegionId(String regionId) {
this.regionId = regionId;
}
public String getRegionModel() {
return regionModel;
}
public void setRegionModel(String regionModel) {
this.regionModel = regionModel;
}
public String getRegionName() {
return regionName;
}
public void setRegionName(String regionName) {
this.regionName = regionName;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserPwd() {
return userPwd;
}
public void setUserPwd(String userPwd) {
this.userPwd = userPwd;
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName;
}
public File getUserPic() {
return userPic;
}
public void setUserPic(File userPic) {
this.userPic = userPic;
}
public String getUserPicFileName() {
return userPicFileName;
}
public void setUserPicFileName(String userPicFileName) {
this.userPicFileName = userPicFileName;
}
public String getUserPicContentType() {
return userPicContentType;
}
public void setUserPicContentType(String userPicContentType) {
this.userPicContentType = userPicContentType;
}
public String getUserSex() {
return userSex;
}
public void setUserSex(String userSex) {
this.userSex = userSex;
}
public String getUserPID() {
return userPID;
}
public void setUserPID(String userPID) {
this.userPID = userPID;
}
public String getUserBornAddress() {
return userBornAddress;
}
public void setUserBornAddress(String userBornAddress) {
this.userBornAddress = userBornAddress;
}
public Date getUserBirthDay() {
return userBirthDay;
}
public void setUserBirthDay(Date userBirthDay) {
this.userBirthDay = userBirthDay;
}
public String getUserNat() {
return userNat;
}
public void setUserNat(String userNat) {
this.userNat = userNat;
}
public String getUserPolity() {
return userPolity;
}
public void setUserPolity(String userPolity) {
this.userPolity = userPolity;
}
public Date getUserJoinTeam() {
return userJoinTeam;
}
public void setUserJoinTeam(Date userJoinTeam) {
this.userJoinTeam = userJoinTeam;
}
public int getUserHight() {
return userHight;
}
public void setUserHight(int userHight) {
this.userHight = userHight;
}
public String getUserIsMarry() {
return userIsMarry;
}
public void setUserIsMarry(String userIsMarry) {
this.userIsMarry = userIsMarry;
}
public String getUserHealthy() {
return userHealthy;
}
public void setUserHealthy(String userHealthy) {
this.userHealthy = userHealthy;
}
public String getUnitId() {
return unitId;
}
public void setUnitId(String unitId) {
this.unitId = unitId;
}
public String getUnitModel() {
return unitModel;
}
public void setUnitModel(String unitModel) {
this.unitModel = unitModel;
}
public String getUnitName() {
return unitName;
}
public void setUnitName(String unitName) {
this.unitName = unitName;
}
public String getDepartmentId() {
return departmentId;
}
public void setDepartmentId(String departmentId) {
this.departmentId = departmentId;
}
public String getDepartmentModel() {
return departmentModel;
}
public void setDepartmentModel(String departmentModel) {
this.departmentModel = departmentModel;
}
public String getDepartmentName() {
return departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
public String getUserTitle() {
return userTitle;
}
public void setUserTitle(String userTitle) {
this.userTitle = userTitle;
}
public String getUserWorkLevel() {
return userWorkLevel;
}
public void setUserWorkLevel(String userWorkLevel) {
this.userWorkLevel = userWorkLevel;
}
public String getUserWorkName() {
return userWorkName;
}
public void setUserWorkName(String userWorkName) {
this.userWorkName = userWorkName;
}
public Date getUserWorkTime() {
return userWorkTime;
}
public void setUserWorkTime(Date userWorkTime) {
this.userWorkTime = userWorkTime;
}
public Date getUserStateWorkTime() {
return userStateWorkTime;
}
public void setUserStateWorkTime(Date userStateWorkTime) {
this.userStateWorkTime = userStateWorkTime;
}
public String getUserXueLi() {
return userXueLi;
}
public void setUserXueLi(String userXueLi) {
this.userXueLi = userXueLi;
}
public String getUserXueWei() {
return userXueWei;
}
public void setUserXueWei(String userXueWei) {
this.userXueWei = userXueWei;
}
public String getUserXueWeiNumber() {
return userXueWeiNumber;
}
public void setUserXueWeiNumber(String userXueWeiNumber) {
this.userXueWeiNumber = userXueWeiNumber;
}
public Date getUserBiYeDate() {
return userBiYeDate;
}
public void setUserBiYeDate(Date userBiYeDate) {
this.userBiYeDate = userBiYeDate;
}
public String getUserBiyeNumber() {
return userBiyeNumber;
}
public void setUserBiyeNumber(String userBiyeNumber) {
this.userBiyeNumber = userBiyeNumber;
}
public String getUserBiyeSchool() {
return userBiyeSchool;
}
public void setUserBiyeSchool(String userBiyeSchool) {
this.userBiyeSchool = userBiyeSchool;
}
public String getUserStudyProject() {
return userStudyProject;
}
public void setUserStudyProject(String userStudyProject) {
this.userStudyProject = userStudyProject;
}
public String getUserPostAddress() {
return userPostAddress;
}
public void setUserPostAddress(String userPostAddress) {
this.userPostAddress = userPostAddress;
}
public String getUserPost() {
return userPost;
}
public void setUserPost(String userPost) {
this.userPost = userPost;
}
public String getOfficeNum() {
return officeNum;
}
public void setOfficeNum(String officeNum) {
this.officeNum = officeNum;
}
public String getAddressNum() {
return addressNum;
}
public void setAddressNum(String addressNum) {
this.addressNum = addressNum;
}
public String getPhoneNum() {
return phoneNum;
}
public void setPhoneNum(String phoneNum) {
this.phoneNum = phoneNum;
}
public String getPhoneNum2() {
return phoneNum2;
}
public void setPhoneNum2(String phoneNum2) {
this.phoneNum2 = phoneNum2;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getYl1() {
return yl1;
}
public void setYl1(String yl1) {
this.yl1 = yl1;
}
public String getYl2() {
return yl2;
}
public void setYl2(String yl2) {
this.yl2 = yl2;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Timestamp getLoginTime() {
return loginTime;
}
public void setLoginTime(Timestamp loginTime) {
this.loginTime = loginTime;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getRoleId() {
return roleId;
}
public void setRoleId(String roleId) {
this.roleId = roleId;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public String getFindPwdQue() {
return findPwdQue;
}
public void setFindPwdQue(String findPwdQue) {
this.findPwdQue = findPwdQue;
}
public String getFindPwdQueAnswer() {
return findPwdQueAnswer;
}
public void setFindPwdQueAnswer(String findPwdQueAnswer) {
this.findPwdQueAnswer = findPwdQueAnswer;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE).append("userName",userName).append("roleName",roleName).toString();
}
}
import java.io.File;
import java.io.Serializable;
import java.sql.Date;
import java.sql.Timestamp;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
public class SysUserVo implements Serializable {
private static final long serialVersionUID = 1L;
// ----------------------用户名及密码-------------------------//
private String userId;
private String userName;
private String userPwd;
// 密保问题
private String findPwdQue;
// 密保问题答案
private String findPwdQueAnswer;
// ----------------------个人基本情况-------------------------//
private String realName;
private File userPic; // 相片
private String userPicFileName; // 相片文件名
private String userPicContentType; // 相片类型
private String userSex; // 性别
private String userPID; // 身份证号
private String userBornAddress; // 出生地点
private Date userBirthDay; // 出生日期
private String userNat; // 民族
private String userPolity; // 政治面貌
private Date userJoinTeam; // 入党时间
private int userHight; // 身高
private String userIsMarry; // 婚姻状况
private String userHealthy; // 健康状况
// ----------------------个人简历-----------------------------//
private String userTitle; // 职务
private String userWorkLevel; // 工作级别
private String userWorkName; // 技术职称
private Date userWorkTime; // 任现职时间
private Date userStateWorkTime; // 参加工作时间
// ----------------------------受教育情况----------------------//
private String userXueLi; // 学历
private String userXueWei; // 学位
private String userXueWeiNumber; // 学位证号
private Date userBiYeDate; // 毕业时间
private String userBiyeNumber; // 毕业证号
private String userBiyeSchool; // 毕业学校
private String userStudyProject; // 所学专业
// ---------------------------------------联系方式-------------//
private String userPostAddress; // 通信地址
private String userPost; // 邮政编码
private String officeNum; // 办公电话
private String addressNum; // 住宅电话
private String phoneNum; // 手机号码1
private String phoneNum2; // 手机号码2
private String email;
private int displayLevel;
// ---------------------------其它字段------------------------------//
private String yl1;
private String yl2;
private String remark;
private Timestamp loginTime;
private String state;
// 拥有哪些角色
// private SysRole userRole;
private String roleId;
private String roleName;
// private SysDepartment userDanwei;//单位
private String unitId;
private String unitModel;
private String unitName;
// private SysDepartment department; //属于那一个部门
private String departmentId;
private String departmentModel;
private String departmentName;
// private SysRegion region;
private String regionId;
private String regionModel;
private String regionName;
// 排序
private String[] usersIds;
private String[] displayLevels;
public int getDisplayLevel() {
return displayLevel;
}
public void setDisplayLevel(int displayLevel) {
this.displayLevel = displayLevel;
}
public String[] getUsersIds() {
return usersIds;
}
public void setUsersIds(String[] usersIds) {
this.usersIds = usersIds;
}
public String[] getDisplayLevels() {
return displayLevels;
}
public void setDisplayLevels(String[] displayLevels) {
this.displayLevels = displayLevels;
}
public String getRegionId() {
return regionId;
}
public void setRegionId(String regionId) {
this.regionId = regionId;
}
public String getRegionModel() {
return regionModel;
}
public void setRegionModel(String regionModel) {
this.regionModel = regionModel;
}
public String getRegionName() {
return regionName;
}
public void setRegionName(String regionName) {
this.regionName = regionName;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserPwd() {
return userPwd;
}
public void setUserPwd(String userPwd) {
this.userPwd = userPwd;
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName;
}
public File getUserPic() {
return userPic;
}
public void setUserPic(File userPic) {
this.userPic = userPic;
}
public String getUserPicFileName() {
return userPicFileName;
}
public void setUserPicFileName(String userPicFileName) {
this.userPicFileName = userPicFileName;
}
public String getUserPicContentType() {
return userPicContentType;
}
public void setUserPicContentType(String userPicContentType) {
this.userPicContentType = userPicContentType;
}
public String getUserSex() {
return userSex;
}
public void setUserSex(String userSex) {
this.userSex = userSex;
}
public String getUserPID() {
return userPID;
}
public void setUserPID(String userPID) {
this.userPID = userPID;
}
public String getUserBornAddress() {
return userBornAddress;
}
public void setUserBornAddress(String userBornAddress) {
this.userBornAddress = userBornAddress;
}
public Date getUserBirthDay() {
return userBirthDay;
}
public void setUserBirthDay(Date userBirthDay) {
this.userBirthDay = userBirthDay;
}
public String getUserNat() {
return userNat;
}
public void setUserNat(String userNat) {
this.userNat = userNat;
}
public String getUserPolity() {
return userPolity;
}
public void setUserPolity(String userPolity) {
this.userPolity = userPolity;
}
public Date getUserJoinTeam() {
return userJoinTeam;
}
public void setUserJoinTeam(Date userJoinTeam) {
this.userJoinTeam = userJoinTeam;
}
public int getUserHight() {
return userHight;
}
public void setUserHight(int userHight) {
this.userHight = userHight;
}
public String getUserIsMarry() {
return userIsMarry;
}
public void setUserIsMarry(String userIsMarry) {
this.userIsMarry = userIsMarry;
}
public String getUserHealthy() {
return userHealthy;
}
public void setUserHealthy(String userHealthy) {
this.userHealthy = userHealthy;
}
public String getUnitId() {
return unitId;
}
public void setUnitId(String unitId) {
this.unitId = unitId;
}
public String getUnitModel() {
return unitModel;
}
public void setUnitModel(String unitModel) {
this.unitModel = unitModel;
}
public String getUnitName() {
return unitName;
}
public void setUnitName(String unitName) {
this.unitName = unitName;
}
public String getDepartmentId() {
return departmentId;
}
public void setDepartmentId(String departmentId) {
this.departmentId = departmentId;
}
public String getDepartmentModel() {
return departmentModel;
}
public void setDepartmentModel(String departmentModel) {
this.departmentModel = departmentModel;
}
public String getDepartmentName() {
return departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
public String getUserTitle() {
return userTitle;
}
public void setUserTitle(String userTitle) {
this.userTitle = userTitle;
}
public String getUserWorkLevel() {
return userWorkLevel;
}
public void setUserWorkLevel(String userWorkLevel) {
this.userWorkLevel = userWorkLevel;
}
public String getUserWorkName() {
return userWorkName;
}
public void setUserWorkName(String userWorkName) {
this.userWorkName = userWorkName;
}
public Date getUserWorkTime() {
return userWorkTime;
}
public void setUserWorkTime(Date userWorkTime) {
this.userWorkTime = userWorkTime;
}
public Date getUserStateWorkTime() {
return userStateWorkTime;
}
public void setUserStateWorkTime(Date userStateWorkTime) {
this.userStateWorkTime = userStateWorkTime;
}
public String getUserXueLi() {
return userXueLi;
}
public void setUserXueLi(String userXueLi) {
this.userXueLi = userXueLi;
}
public String getUserXueWei() {
return userXueWei;
}
public void setUserXueWei(String userXueWei) {
this.userXueWei = userXueWei;
}
public String getUserXueWeiNumber() {
return userXueWeiNumber;
}
public void setUserXueWeiNumber(String userXueWeiNumber) {
this.userXueWeiNumber = userXueWeiNumber;
}
public Date getUserBiYeDate() {
return userBiYeDate;
}
public void setUserBiYeDate(Date userBiYeDate) {
this.userBiYeDate = userBiYeDate;
}
public String getUserBiyeNumber() {
return userBiyeNumber;
}
public void setUserBiyeNumber(String userBiyeNumber) {
this.userBiyeNumber = userBiyeNumber;
}
public String getUserBiyeSchool() {
return userBiyeSchool;
}
public void setUserBiyeSchool(String userBiyeSchool) {
this.userBiyeSchool = userBiyeSchool;
}
public String getUserStudyProject() {
return userStudyProject;
}
public void setUserStudyProject(String userStudyProject) {
this.userStudyProject = userStudyProject;
}
public String getUserPostAddress() {
return userPostAddress;
}
public void setUserPostAddress(String userPostAddress) {
this.userPostAddress = userPostAddress;
}
public String getUserPost() {
return userPost;
}
public void setUserPost(String userPost) {
this.userPost = userPost;
}
public String getOfficeNum() {
return officeNum;
}
public void setOfficeNum(String officeNum) {
this.officeNum = officeNum;
}
public String getAddressNum() {
return addressNum;
}
public void setAddressNum(String addressNum) {
this.addressNum = addressNum;
}
public String getPhoneNum() {
return phoneNum;
}
public void setPhoneNum(String phoneNum) {
this.phoneNum = phoneNum;
}
public String getPhoneNum2() {
return phoneNum2;
}
public void setPhoneNum2(String phoneNum2) {
this.phoneNum2 = phoneNum2;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getYl1() {
return yl1;
}
public void setYl1(String yl1) {
this.yl1 = yl1;
}
public String getYl2() {
return yl2;
}
public void setYl2(String yl2) {
this.yl2 = yl2;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Timestamp getLoginTime() {
return loginTime;
}
public void setLoginTime(Timestamp loginTime) {
this.loginTime = loginTime;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getRoleId() {
return roleId;
}
public void setRoleId(String roleId) {
this.roleId = roleId;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public String getFindPwdQue() {
return findPwdQue;
}
public void setFindPwdQue(String findPwdQue) {
this.findPwdQue = findPwdQue;
}
public String getFindPwdQueAnswer() {
return findPwdQueAnswer;
}
public void setFindPwdQueAnswer(String findPwdQueAnswer) {
this.findPwdQueAnswer = findPwdQueAnswer;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE).append("userName",userName).append("roleName",roleName).toString();
}
}
2.服务类
package
cn.gov.luzhou.SiteServer.user.business.webService;
import org.apache.axis.AxisFault;
import cn.gov.luzhou.SiteServer.user.business.service.SysUserService;
import cn.gov.luzhou.SiteServer.user.business.util.AppContext;
import cn.gov.luzhou.SiteServer.user.web.vo.SysUserVo;
/** */ /**
*
* @author 向才鹏
* @version 1.0
* Copyright (C), 2009,www.soujava.cn所有
* Date: Aug 17, 2010 3:52:19 PM
*/
public class UserService {
//登录
public SysUserVo login(String username,String password) throws AxisFault{
SysUserService sysUserService = (SysUserService) AppContext.getBean("sysUserService");
SysUserVo userVo = null;
try {
userVo = sysUserService.login(username, password);
} catch (Exception e) {
throw new AxisFault("login error",e);
}
return userVo;
}
}
import org.apache.axis.AxisFault;
import cn.gov.luzhou.SiteServer.user.business.service.SysUserService;
import cn.gov.luzhou.SiteServer.user.business.util.AppContext;
import cn.gov.luzhou.SiteServer.user.web.vo.SysUserVo;
/** */ /**
*
* @author 向才鹏
* @version 1.0
* Copyright (C), 2009,www.soujava.cn所有
* Date: Aug 17, 2010 3:52:19 PM
*/
public class UserService {
//登录
public SysUserVo login(String username,String password) throws AxisFault{
SysUserService sysUserService = (SysUserService) AppContext.getBean("sysUserService");
SysUserVo userVo = null;
try {
userVo = sysUserService.login(username, password);
} catch (Exception e) {
throw new AxisFault("login error",e);
}
return userVo;
}
}
3.deploy.wsdd
<?
xml version
=
"
1.0
"
encoding
=
"
UTF-8
"
?>
< deployment xmlns = " http://xml.apache.org/axis/wsdd/ " xmlns:java = " http://xml.apache.org/axis/wsdd/providers/java " >
< service name = " UserService " provider = " java:RPC " >
< parameter name = " className " value = " cn.gov.luzhou.SiteServer.user.business.webService.UserService " />
< parameter name = " allowedMethods " value = " * " />
< typeMapping qname = " my:User " xmlns:my = " urn:UserService "
encodingStyle = " http://schemas.xmlsoap.org/soap/encoding/ " serializer = " org.apache.axis.encoding.ser.BeanSerializerFactory "
deserializer = " org.apache.axis.encoding.ser.BeanDeserializerFactory " type = " java:cn.gov.luzhou.SiteServer.user.web.vo.SysUserVo " />
</ service >
</ deployment >
< deployment xmlns = " http://xml.apache.org/axis/wsdd/ " xmlns:java = " http://xml.apache.org/axis/wsdd/providers/java " >
< service name = " UserService " provider = " java:RPC " >
< parameter name = " className " value = " cn.gov.luzhou.SiteServer.user.business.webService.UserService " />
< parameter name = " allowedMethods " value = " * " />
< typeMapping qname = " my:User " xmlns:my = " urn:UserService "
encodingStyle = " http://schemas.xmlsoap.org/soap/encoding/ " serializer = " org.apache.axis.encoding.ser.BeanSerializerFactory "
deserializer = " org.apache.axis.encoding.ser.BeanDeserializerFactory " type = " java:cn.gov.luzhou.SiteServer.user.web.vo.SysUserVo " />
</ service >
</ deployment >
二、客户端
1.新建一个VO对象,对象SysUserVo
2.客户端调用类
package
two;
import java.net.MalformedURLException;
import java.rmi.RemoteException;
import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceException;
import org.apache.axis.AxisFault;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.ser.BeanDeserializerFactory;
import org.apache.axis.encoding.ser.BeanSerializerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/** */ /**
*
* @author 向才鹏
* @version 1.0
* Copyright (C), 2009,www.soujava.cn所有
* Date: Aug 17, 2010 4:52:04 PM
*/
public class TestUserService {
private static final Log log = LogFactory.getLog(TestUserService.class);
private static final String HELLO_SERVICE_ENDPOINT = "http://localhost:8080/EGSS_User/services/UserService?wsdl";
public static void main(String[] args) {
TestUserService tester = new TestUserService();
tester.callSayHello();
}
public void callSayHello() {
try {
Service service = new Service();
Call call = (Call) service.createCall();
//设置请求地址和方法
call.setTargetEndpointAddress(new java.net.URL(HELLO_SERVICE_ENDPOINT));
call.setOperationName(new QName(HELLO_SERVICE_ENDPOINT,"login"));
//设置参数
call.addParameter("username", org.apache.axis.Constants.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.addParameter("password", org.apache.axis.Constants.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
//第一个参数名字空间URI,第二个参数本地部分,注意这两部分在server-config.wsdd文件中标签beanMapping配置
QName qn = new QName("urn:UserService", "User");
// //注册数据类型
call.setReturnType(qn);
call.registerTypeMapping(SysUserVo.class, qn,
new BeanSerializerFactory(SysUserVo.class, qn),//序列化
new BeanDeserializerFactory(SysUserVo.class, qn));
try {
SysUserVo user = (SysUserVo) call.invoke(new Object[]{"ptyhcs","111111"});
/**//*if(user != null){
System.out.println(user.getRoleName());
System.out.println(user.getUnitName());
}*/
System.out.println(user);
return;
} catch (AxisFault fault) {
System.out.println("1Error : " + fault.getMessage());
} catch (RemoteException e) {
e.printStackTrace();
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (ServiceException e) {
e.printStackTrace();
}
log.error("call sayHello service error!");
}
}
import java.net.MalformedURLException;
import java.rmi.RemoteException;
import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceException;
import org.apache.axis.AxisFault;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.ser.BeanDeserializerFactory;
import org.apache.axis.encoding.ser.BeanSerializerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/** */ /**
*
* @author 向才鹏
* @version 1.0
* Copyright (C), 2009,www.soujava.cn所有
* Date: Aug 17, 2010 4:52:04 PM
*/
public class TestUserService {
private static final Log log = LogFactory.getLog(TestUserService.class);
private static final String HELLO_SERVICE_ENDPOINT = "http://localhost:8080/EGSS_User/services/UserService?wsdl";
public static void main(String[] args) {
TestUserService tester = new TestUserService();
tester.callSayHello();
}
public void callSayHello() {
try {
Service service = new Service();
Call call = (Call) service.createCall();
//设置请求地址和方法
call.setTargetEndpointAddress(new java.net.URL(HELLO_SERVICE_ENDPOINT));
call.setOperationName(new QName(HELLO_SERVICE_ENDPOINT,"login"));
//设置参数
call.addParameter("username", org.apache.axis.Constants.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.addParameter("password", org.apache.axis.Constants.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
//第一个参数名字空间URI,第二个参数本地部分,注意这两部分在server-config.wsdd文件中标签beanMapping配置
QName qn = new QName("urn:UserService", "User");
// //注册数据类型
call.setReturnType(qn);
call.registerTypeMapping(SysUserVo.class, qn,
new BeanSerializerFactory(SysUserVo.class, qn),//序列化
new BeanDeserializerFactory(SysUserVo.class, qn));
try {
SysUserVo user = (SysUserVo) call.invoke(new Object[]{"ptyhcs","111111"});
/**//*if(user != null){
System.out.println(user.getRoleName());
System.out.println(user.getUnitName());
}*/
System.out.println(user);
return;
} catch (AxisFault fault) {
System.out.println("1Error : " + fault.getMessage());
} catch (RemoteException e) {
e.printStackTrace();
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (ServiceException e) {
e.printStackTrace();
}
log.error("call sayHello service error!");
}
}
名称: ♪4C.ESL | .↗Evon
口号: 遇到新问题♪先要寻找一个方案乄而不是创造一个方案こ
mail: 联系我