Develop a service endpoint interface

The service endpoint interface defines the Web services methods. The Web service implementation, whether an enterprise bean or a Java bean, must implement methods that have the same signature as the methods on the service endpoint interface. There are a number of restrictions on which types to use as parameters and results of service endpoint interface methods. These restrictions are documented in the Java API for XML remote procedure call (JAX-RPC) specification. Link outside Information Center

If the Web service implementation is an enterprise bean, develop the service endpoint interface from an enterprise bean remote interface. If the Web service implementation is a Java bean, develop the service endpoint interface from the bean or an interface the bean implements.

To develop a service endpoint interface, follow these steps:

  1. Create a Java interface that contains the methods that you want to include in the service endpoint interface.
    The interface should extend the java.rmi.Remote interface. Each method throws the java.rmi.RemoteException exception. If you start with an existing Java interface, remove any methods that do not conform to JAX-RPC.

  2. Compile the interface.
    You need /QIBM/ProdData/WebAS5/Edition/lib/j2ee.jar in your CLASSPATH to compile the interface.

Example

This example uses a Java interface called AddressBook.

package addr;
public interface AddressBook extends java.rmi.Remote {
    /**
     * Retrieve an entry from the AddressBook.
     *
     *@param name the name of the entry to look up.
     *@return the AddressBook entry matching name or null if none.
     *@throws java.rmi.RemoteException if communications failure.
     */
    public addr.Address getAddressFromName(java.lang.String name)
      throws java.rmi.RemoteException;
}

Use the AddressBook Java interface to create the service endpoint interface:

  1. Begin with the remote interface, AddressBook_RI.java:

    package addr;
    import java.rmi.RemoteException;
    import javax.ejb.EJBObject;
    public interface AddressBook_RI extends EJBObject {
        /**
         * Retrieve an entry from the AddressBook.
         *
         *@param name the name of the entry to look up.
         *@return the AddressBook entry matching name or null if none.
         *@throws java.rmi.RemoteException if communications failure.
         */
        public addr.Address getAddressFromName(java.lang.String name)
          throws java.rmi.RemoteException;
    }
  2. Make a copy of the remote interface named AddressBook.java and use it as a template for the service endpoint interface.

  3. Change the interface to extend the java.rmi.Remote interface, instead of the EJBObject interface.

  4. Compile the interface.