Develop a Service Endpoint Interface for a Java bean implementation

Set up a Web services development and unmanaged client execution environment.

The Service Endpoint Interface defines the methods for a particular Web service. The Java bean implementation must implement methods having 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-based remote procedure call (JAX-RPC) specification, which is available through Web services: Resources for learning.

You can also create a Service Endpoint Interface by using the Assembly Toolkit, which is a component of the Application Assembly Toolkit. The steps are similar except the Assembly Toolkit automatically compiles the interface when you save it. To develop a Service Endpoint Interface for a Java bean implementation...

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

  2. Compile the interface. Use the javac commands for Windows and UNIX platforms listed in the topic Developing thin application client code to compile the interface. In the javac command, use the name of the Service Endpoint Interface class for the class to be compiled.

A Service Endpoint Interface which you can use to develop a Web service.


Usage Scenario

This example uses a Java interface called AddressBook. The following example depicts the AddressBook interface

package addr;
public interface AddressBook {
     * 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);

You use the AddressBook Java interface to create the Service Endpoint Interface...

  1. Begin with the remote interface,

  2. Make a copy of the remote interface named and use it as a template for the Service Endpoint Interface.

  3. Change the interface to extend the java.rmi.Remote interface.

  4. Modify each method declaration to add a throws clause for java.rmi.RemoteException.

  5. Compile the interface.

Use the Service Endpoint Interface to Develop a WSDL file.


See Also

Developing a Web service from a Java bean
Artifacts used to develop Web services based on Web Services for J2EE