Business Interface
Create the bean interface and mark it either as @Remote, @Local or @WebService.
Remote Interface
import javax.ejb.Remote; @Remote public interface HelloWorld { String sayHello(); }
Local Interface
import javax.ejb.Local; @Local public interface HelloWorld { String sayHello(); }
Web service interface
import javax.jws.WebService; @WebService public interface HelloWorld { String sayHello(); }
Bean implementation class
Create a class which implements the business interface. Mark this class as stateless session bean using @Stateless annotation before the class signature.
import javax.ejb.Stateless; @Stateless public class HelloWorldBean implements HelloWorld { public HelloWorldBean() { } public String sayHello() { return "Hello World !!!"; } }