+

Search Tips   |   Advanced Search

Develop a service endpoint interface from JavaBeans for JAX-RPC applications

We must develop a service endpoint interface if we are developing a JAX-RPC web service from a JavaBeans implementation.

We need to set up a development environment for web services and access an existing Java bean web application archive (WAR) file. See the setting up a development environment for web services information.

This task is a required step in developing a JAX-RPC Web service from a Java bean.

The service endpoint interface defines the methods for particular JAX-RPC web services. The JavaBeans implementation must implement methods with the same signature as the methods on the service endpoint interface. A number of restrictions apply on which types to use as parameters and results of service endpoint interface methods. These restrictions are documented in the JAX-RPC specification.

We can also create a service endpoint interface using assembly tools.

Develop a service endpoint interface for a JavaBeans implementation by following the actions listed:


Tasks

  1. Create a Java interface containing the methods to include in the service endpoint interface. If we start with an existing Java interface, remove any methods that do not conform to the JAX-RPC specification.
  2. Compile the interface.

    Use the name of the service endpoint interface class in the javac command for the class to compile.

    (Windows) Use the javac commands.

    (Linux) (AIX) (HPUX) (Solaris) On operating systems such as AIX or Linux, see the developing thin application client code information.

    (iSeries) Ensure the j2ee.jar file is in your class path to compile the interface. The JAR file is located in the app_server_root/dev/JavaEE directory path.

We have developed a service endpoint interface that we can use to develop web services.


Example

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);
}

Use the AddressBook interface to create the service endpoint interface:

  1. Make a copy of the AddressBook.java interface and name it AddressBook_SEI.java. Use this copy as a template for the service endpoint interface.
  2. Compile the interface.


What to do next

Continue to gather the artifacts required to develop a web service, including the WSDL file. We need to develop a WSDL file because it is the engine of a web service. Without a WSDL file, we do not have a web service. See the developing a WSDL file for JAX-RPC applications information.


Related:

  • Development and assembly tools
  • Implement web services applications with JAX-RPC
  • Implement web services applications from existing WSDL files with JAX-RPC
  • Set up a development environment for web services

    (Linux) (AIX) (HPUX) (Solaris) Developing stand-alone thin client applications

  • Developing a WSDL file for JAX-RPC applications
  • Artifacts used to develop web services
  • Web services specifications and APIs