Complete Example Program - EnterWorks_Process_Exchange_(EPX) - 10.6

EnterWorks EPX Programmers Reference

Product type
Software
Portfolio
Verify
Product family
EnterWorks
Product
Precisely EnterWorks > EnterWorks Process Exchange (EPX)
Version
10.6
Language
English
Product name
Precisely EnterWorks
Title
EnterWorks EPX Programmers Reference
Topic type
Reference
Programming Reference
First publish date
2007
ft:lastEdition
2023-07-28
ft:lastPublication
2023-09-20T04:07:07.148709

This final section provides the complete code for the main program used in this example. Every example program in the EPX installation takes at a minimum three arguments:

  • -server — the unique identifier of the server to log into. This parameter defaults to the first server returned by the EPX application server.

  • -user — the login identifier of the user to log in, defaults to the EPX super user system

  • -password — the password of the user to log in as, which defaults to the installation password of the EPX super user system, which is system

For example:

C:\Enterworks\EPX\examples\api\run.bat LoginExample

-server EPX_somehost -user system -password system public static void main(String args[]) throws Exception

{

try

{

String serverUID = null;

String user = "system";

String password = "system";

for ( int i=0 ; i < args.length; i++)

{

String arg = args[i];

if (arg.startsWith("-"))

{

if (arg.substring(1).equals("server"))

serverUID = args[++i];

else if (arg.substring(1).equals("user"))

user = args[++i];

else if (arg.substring(1).equals("password"))

password = args[++i];

}

}

LoginExample example =

new loginExample(serverUID,user,password);

// login

example.login();

if ( example.getSessionProfile() != null )

{

// show the session id

String vargs[] = {

example.getServerProfile().getDisplayLabel(),

String.valueOf (

example.getSessionProfile().getSessionId() ) };

System.out.println(

example.getMessage( "login.session", vargs) );

// log out example.logout();

}

}

catch( Exception e )

{

System.err.println ( "LoginExample.main(exception):" + e );

e.printStackTrace();

}

}

}