2 Replies Latest reply on Mar 20, 2007 10:29 PM by monowai

    Why interface for EJB3 webservices?

    Frank Zartmann Newbie

      Hi,

      I'm investigating your examples in jbossws-samples-1.2.0.SP1.
      In your example for EJB3 webservices you use two classes:

      1) An interface (EJB3RemoteInterface)
      2) The stateless session bean implementing the operation of the webservice (EJB3Bean01)

      ..
      // standard JSR181 annotations
      @WebService(name = "EndpointInterface", targetNamespace = "http://org.jboss.ws/samples/jsr181ejb", serviceName = "TestService")
      @SOAPBinding(style = SOAPBinding.Style.RPC)
      
      // standard EJB3 annotations
      @Remote(EJB3RemoteInterface.class)
      @RolesAllowed("friend")
      @Stateless
      
      // jboss propriatary annotations
      @RemoteBinding(jndiBinding = "/ejb3/EJB3Bean01")
      @WebContext(authMethod="BASIC", transportGuarantee="NONE", secureWSDLAccess=false)
      @SecurityDomain("JBossWS")
      public class EJB3Bean01 implements EJB3RemoteInterface
      {
       @WebMethod
       @WebResult(name = "result")
       public String echo(@WebParam(name = "String_1") String input)
       {
       return input;
       }
      }

      I also have a small session bean / webservice :
      @WebService
      @Stateless
      public class EjbEndpoint {
      
       @WebMethod
       public String sayHello(String name)
       {
       return "Hello "+name+"!";
       }
      }

      and I can successfully deploy this session bean / webservice to jboss-5 Beta 2. Even I am able to call the webservice.

      My question: What's the purpose of the interface? Have I missed something?

      Thanks in adavance!

      Frank