Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
connect to worksitemp thorugh java file
jaylin
Hi,
This is my very first time to connect to worksite from java file. I don't know how to do actually and anyone can show me the way to do.
i have attached my source and the error msg screen.
Find more posts tagged with
Comments
JTNeville
Example files from the SDK attached. Enjoy.
Puneet303
// public static userID="";
similarly declare and initialize all the variables like domain, password,applicationnameserver,to which you need to connect to.
public static void main(String args[]){
try{
SessionManager manager = SessionManager.getInstance();
System.out.println(" Creating Session");
SimpleSession session = manager.createSimpleSession(applicationName,serverName);
if(domain != null || !(domain.equals(""))){
session.logon(domain,userId, password);
}else{
session.logon(userId, password);
}
System.out.println("....logged ....succesfully.....");
Puneet303
public static String userID="";
similarly declare and initialize all the String variables like domain, password,applicationnameserver,to which you need to connect to.
public static void main(String args[]){
try{
SessionManager manager = SessionManager.getInstance();
System.out.println(" Creating Session");
SimpleSession session = manager.createSimpleSession(applicationName,serverName);
if(domain != null || !(domain.equals(""))){
session.logon(domain,userId, password);
}else{
session.logon(userId, password);
}
System.out.println("....logged ....succesfully.....");
Migrateduser
public class Login{
public static void main(String args[]){
try{
// Command-line propmt for userId, password, domain,applicationName and serverName
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader ( isr );
String userId = null;
String password = null;
String domain = null;
String applicationName = null;
String serverName = null;
try {
System.out.println("Enter the User ID : ");
userId = br.readLine();
System.out.println("Enter the Password : ");
password = br.readLine();
System.out.println("Enter the Domain : ");
domain = br.readLine();
System.out.println("Enter the Application Name : ");
applicationName = br.readLine();
System.out.println("Enter the Server Name : ");
serverName = br.readLine();
}
catch ( IOException ioe ) {
System.out.println("Error reading User input : " + ioe);
}
System.out.println("Creating Session Manager...");
SessionManager manager = SessionManager.getInstance();
System.out.println("Session Manager created. Creating Simple Session...");
// Create a SimpleSession
SimpleSession session = manager.createSimpleSession(applicationName,serverName);
System.out.println("Simple Session created. Login...");
// Login to the session
if(domain != null || !(domain.equals(""))){
session.logon(domain,userId, password);
}else{
session.logon(userId, password);
}
System.out.println("Logged in. Ping...");
// Test the connection.
session.ping();
System.out.println("Connection OK.");
// Logoff from the session.
session.logoff();
System.out.println("Logged off.");
}catch(Exception e){
System.out.println("Exception :: " + e);
e.printStackTrace();
}
}
}