+

Search Tips   |   Advanced Search

Develop a service endpoint interface from enterprise beans for JAX-RPC applications

We can develop a service endpoint interface from an EJB for JAX-RPC web services.

Set up a development environment for web services. To learn more, see the setting up a development environment for web services information.

Set up a development environment for web services.

This task is a required step in developing a JAX-RPC web service from an enterprise bean.

The service endpoint interface defines the web services methods. The enterprise beans that implements the web service must implement methods having the same signature as the methods of the service endpoint interface. A number of restrictions exist on which types to use as parameters and results of service endpoint interface methods. These restrictions are documented in the JAX-RPC specification. See the web services specifications and API documentation to review the JAX-RPC specification along with a complete list of the supported standards and specifications.

The easiest method for creating the service endpoint interface for an EJB web service implementation is from the EJB remote interface.

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

Develop a service endpoint interface by following the steps provided in this task section.


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 stand-alone thin client applications documentation.

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

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


Example

This example uses the EJB remote interface, AddressBook_RI, to create a service endpoint interface for an EJB implementation used as a web service. The following code example illustrates the AddressBook_RI remote interface.
package addr;
public interface AddressBook_RI extends javax.ejb.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;
}
Use the following steps to create the service endpoint interface with the AddressBook_RI remote interface:

  1. Locate a remote interface that has already been created, like the AddressBook_RI.java remote interface.

  2. Make a copy of the AddressBook.java remote interface and use it as a template for the service endpoint interface.
  3. Compile the AddressBook.java service endpoint interface.


What to do next

Continue gathering 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 have no web service.


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
  • Developing a WSDL file for JAX-RPC applications

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

  • Artifacts used to develop web services
  • Web services specifications and APIs