📄 logonaction.java
字号:
/*
* Project:test PX&WSX
* Author :Tyler mao
* Description:
* Copyright: agile Co.
* Created on 2005-7-1
*/
package client.agile.com;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.methods.GetMethod;
import com.agile.api.IAgileSession;
import com.agile.api.IDataObject;
import com.agile.api.INode;
import com.agile.px.ActionResult;
import com.agile.px.ICustomAction;
public class LogonAction implements ICustomAction {
private Service service = new Service();
private Call call = null;
private static final String WSX = "http://localhost/Agile/ws/Logon";
//private static final String METHOD = "login2Server";
private static final String METHOD = "getECO";
private String userName = "demo1";
private String pwd = "agile";
public LogonAction(){init();}
private void init() {
System.out.println("Checking WSX connection ...");
try{
call = (Call)service.createCall();
call.setTargetEndpointAddress(WSX);
call.setUsername(userName);
call.setPassword(pwd);
}catch(Exception e){
e.printStackTrace();
}
}///:~ init() Ends
private ActionResult result = null;
public ActionResult doAction(IAgileSession arg0, INode arg1, IDataObject arg2) {
String res="PX USER is:";
try{
String pxUser=arg0.getCurrentUser().getName();
res+=pxUser;
call.setOperationName(METHOD);
//String WSXres = (String) call.invoke(new Object[]{});
String WSXres = (String)call.invoke(new Object[]{});
res+=" The wsx user is yvonnec or not:"+userName.equals(WSXres);
String pxOldUser=arg0.getCurrentUser().getName();
res+=" The px old user is:"+pxOldUser;
System.out.println(res);
this.result = new ActionResult(ActionResult.STRING, res);
}catch(Exception e){
e.printStackTrace();
}
return this.result;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -