public class Client
{
public static void main(String args[]) throws Exception
{
Context ctx = new InitialContext();
CompleteXMLDD completeXMLDDBean = (CompleteXMLDD) ctx.lookup("CompleteXMLDD/remote");
SecurityClient securityClient = SecurityClientFactory.getSecurityClient();
securityClient.setSimple("jai", "jai123");
securityClient.login();
System.out.println("jai is a normal user");
// call sayHello
System.out.println(completeXMLDDBean.sayHello("jai"));
// call greet methods
System.out.println(completeXMLDDBean.greetWithNotSupportedTransaction("jai"));
System.out.println(completeXMLDDBean.greetWithRequiredTransaction("jai"));
// bye
System.out.println(completeXMLDDBean.sayBye("jai"));
// let's try the uncallable method
System.out.println("We'll try calling an uncallable method");
try
{
completeXMLDDBean.uncallableMethod();
throw new RuntimeException("Bean method in <excluded-list> was allowed to be invoked");
}
catch (EJBAccessException e)
{
System.out.println("Caught expected exception : " + e.getMessage());