1 19 package org.openharmonise.him.harmonise; 20 21 import java.net.*; 22 import java.rmi.RemoteException ; 23 24 import org.apache.axis.client.Call; 25 import org.apache.axis.client.Service; 26 27 import javax.xml.namespace.QName ; 28 import javax.xml.rpc.ServiceException ; 29 30 37 public class UserConfigClient { 38 39 public static final int CODE_SUCCESS = 200; 40 public static final int CODE_AUTHENTICATION_FAIL = 402; 41 public static final int CODE_INVALID_LENGTH = 403; 42 public static final int CODE_NO_ALPHA_CHAR = 404; 43 public static final int CODE_NO_NUM_CHAR = 405; 44 public static final int CODE_NO_CASE_MIX = 406; 45 public static final int CODE_INVALID_USER_STATE = 407; 46 public static final int CODE_PWD_REPEAT = 408; 47 public static final String SIMULACRA_WEBSERVICE_NAMESPACE_URI = 48 "http://www.openharmonise.org/"; 49 50 53 public UserConfigClient() { 54 super(); 55 } 56 57 71 public static int setPassword( 72 URL endpoint, 73 String sCurrUserName, 74 String sCurrUserPwd, 75 String sChangeUserName, 76 String sChangeNewPwd) 77 throws java.rmi.RemoteException , ServiceException { 78 79 Service service = new Service(); 80 Call call = (Call) service.createCall(); 81 82 call.setTargetEndpointAddress(endpoint); 83 call.setOperationName( 84 new QName (SIMULACRA_WEBSERVICE_NAMESPACE_URI, "setPassword")); 85 86 call.addParameter( 87 "sCurrUserName", 88 org.apache.axis.Constants.XSD_STRING, 89 javax.xml.rpc.ParameterMode.IN); 90 call.addParameter( 91 "sCurrUserPwd", 92 org.apache.axis.Constants.XSD_STRING, 93 javax.xml.rpc.ParameterMode.IN); 94 95 call.addParameter( 96 "sChangeUserName", 97 org.apache.axis.Constants.XSD_STRING, 98 javax.xml.rpc.ParameterMode.IN); 99 100 call.addParameter( 101 "sChangeNewPwd", 102 org.apache.axis.Constants.XSD_STRING, 103 javax.xml.rpc.ParameterMode.IN); 104 105 call.setReturnType(org.apache.axis.Constants.XSD_INTEGER); 106 call.setReturnClass(Integer .class); 107 108 Integer ret = 109 (Integer ) call.invoke( 110 new Object [] { 111 sCurrUserName, 112 sCurrUserPwd, 113 sChangeUserName, 114 sChangeNewPwd }); 115 116 return ret.intValue(); 117 118 } 119 120 131 static public boolean hasPasswordExpired( 132 URL endpoint, 133 String sUserName, 134 String sPwd) 135 throws ServiceException , RemoteException { 136 Service service = new Service(); 137 Call call = (Call) service.createCall(); 138 139 call.setTargetEndpointAddress(endpoint); 140 call.setOperationName( 141 new QName ( 142 SIMULACRA_WEBSERVICE_NAMESPACE_URI, 143 "hasPasswordExpired")); 144 145 call.addParameter( 146 "sUserName", 147 org.apache.axis.Constants.XSD_STRING, 148 javax.xml.rpc.ParameterMode.IN); 149 call.addParameter( 150 "sPwd", 151 org.apache.axis.Constants.XSD_STRING, 152 javax.xml.rpc.ParameterMode.IN); 153 154 call.setReturnType(org.apache.axis.Constants.XSD_BOOLEAN); 155 call.setReturnClass(Boolean .class); 156 157 Boolean ret = (Boolean ) call.invoke(new Object [] { sUserName, sPwd }); 158 159 return ret.booleanValue(); 160 } 161 162 173 static public boolean isSuperUser( 174 URL endpoint, 175 String sUserName, 176 String sPwd) 177 throws ServiceException , RemoteException { 178 Service service = new Service(); 179 Call call = (Call) service.createCall(); 180 181 call.setTargetEndpointAddress(endpoint); 182 call.setOperationName( 183 new QName (SIMULACRA_WEBSERVICE_NAMESPACE_URI, "isSuperUser")); 184 185 call.addParameter( 186 "sUserName", 187 org.apache.axis.Constants.XSD_STRING, 188 javax.xml.rpc.ParameterMode.IN); 189 call.addParameter( 190 "sPwd", 191 org.apache.axis.Constants.XSD_STRING, 192 javax.xml.rpc.ParameterMode.IN); 193 194 call.setReturnType(org.apache.axis.Constants.XSD_BOOLEAN); 195 call.setReturnClass(Boolean .class); 196 197 Boolean ret = (Boolean ) call.invoke(new Object [] { sUserName, sPwd }); 198 199 return ret.booleanValue(); 200 } 201 202 213 static public boolean isSuperUser( 214 URL endpoint, 215 String sUserName, 216 String sPwd, 217 String sCheckUser) 218 throws ServiceException , RemoteException { 219 Service service = new Service(); 220 Call call = (Call) service.createCall(); 221 222 call.setTargetEndpointAddress(endpoint); 223 call.setOperationName( 224 new QName (SIMULACRA_WEBSERVICE_NAMESPACE_URI, "isSuperUser")); 225 226 call.addParameter( 227 "sUserName", 228 org.apache.axis.Constants.XSD_STRING, 229 javax.xml.rpc.ParameterMode.IN); 230 call.addParameter( 231 "sPwd", 232 org.apache.axis.Constants.XSD_STRING, 233 javax.xml.rpc.ParameterMode.IN); 234 call.addParameter( 235 "sCheckUser", 236 org.apache.axis.Constants.XSD_STRING, 237 javax.xml.rpc.ParameterMode.IN); 238 239 call.setReturnType(org.apache.axis.Constants.XSD_BOOLEAN); 240 call.setReturnClass(Boolean .class); 241 242 Boolean ret = (Boolean ) call.invoke(new Object [] { sUserName, sPwd, sCheckUser }); 243 244 return ret.booleanValue(); 245 } 246 247 257 static public boolean isUserLockedOut( 258 URL endpoint, 259 String sUserName) 260 throws ServiceException , RemoteException { 261 Service service = new Service(); 262 Call call = (Call) service.createCall(); 263 264 call.setTargetEndpointAddress(endpoint); 265 call.setOperationName( 266 new QName (SIMULACRA_WEBSERVICE_NAMESPACE_URI, "isUserLockedOut")); 267 268 call.addParameter( 269 "sUserName", 270 org.apache.axis.Constants.XSD_STRING, 271 javax.xml.rpc.ParameterMode.IN); 272 273 274 call.setReturnType(org.apache.axis.Constants.XSD_BOOLEAN); 275 call.setReturnClass(Boolean .class); 276 277 Boolean ret = (Boolean ) call.invoke(new Object [] { sUserName}); 278 279 return ret.booleanValue(); 280 } 281 282 283 284 297 public static void setIsSuperUser( 298 URL endpoint, 299 String sCurrUserName, 300 String sPwd, 301 String sChangeUser, 302 boolean bIsSuper) 303 throws java.rmi.RemoteException , ServiceException { 304 305 Service service = new Service(); 306 Call call = (Call) service.createCall(); 307 308 call.setTargetEndpointAddress(endpoint); 309 call.setOperationName( 310 new QName (SIMULACRA_WEBSERVICE_NAMESPACE_URI, "setIsSuperUser")); 311 312 call.addParameter( 313 "sCurrUserName", 314 org.apache.axis.Constants.XSD_STRING, 315 javax.xml.rpc.ParameterMode.IN); 316 call.addParameter( 317 "sPwd", 318 org.apache.axis.Constants.XSD_STRING, 319 javax.xml.rpc.ParameterMode.IN); 320 321 call.addParameter( 322 "sChangeUser", 323 org.apache.axis.Constants.XSD_STRING, 324 javax.xml.rpc.ParameterMode.IN); 325 326 call.addParameter( 327 "bIsSuper", 328 org.apache.axis.Constants.XSD_BOOLEAN, 329 javax.xml.rpc.ParameterMode.IN); 330 331 call.setReturnType(org.apache.axis.Constants.XSD_INTEGER); 332 333 Integer ret = 334 (Integer ) call.invoke( 335 new Object [] { 336 sCurrUserName, 337 sPwd, 338 sChangeUser, 339 new Boolean (bIsSuper) }); 340 341 } 342 343 } 344 | Popular Tags |