The Web service endpoint interface is used to define the ‘Web services methods’. It is necessary for an enterprise bean that implements the Web service to implement methods having the same signature, as the methods of the Web service endpoint interface. There are a numbers of restrictions exist on which types to use as parameters and results of service endpoint interface methods. It provides the client’s view of the Web service, hiding the stateless session bean from the client. A Web service endpoint interface must conform to the rules of a JAX-RPC service definition interface. A Web service endpoint interface must conform to the following rules:
It should extend the java.rmi.Remote interface.
It must not have constant declarations, such as public, final, or static.
The methods must throw the java.rmi.RemoteException or one of its subclasses. Method parameters and return types must be supported JAX-RPC types.
For example:
package bookaccount;
import java.rmi.RemoteException;
import java.rmi.Remote;
public interface BookAccount extends Remote {
public String sayBook(String name) throws RemoteException;
}
Here, BookAccount is the Web service endpoint interface and the class that implements this interface must implement the sayBook() method defined by the BookAccount interface. The interface decouples the implementation class from the type of client access. For example, if a remote and home interface is added to a class named BookAccountBean, the methods of the BookAccountBean class could also be accessed by remote clients.
Responses to “What is the Web service endpoint interface?”