+

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 Java API for XML-based remote procedure call (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 by using assembly tools..

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

  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.

    Use the javac commands.

    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 the CLASSPATH to compile the interface. The JAR file is located in the app_server_root/dev/JavaEE directory path.


Results

You have a service endpoint interface that 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. You 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 concepts

  • Development and assembly tools


    Related tasks

  • 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
  • Develop a WSDL file for JAX-RPC applications
  • Develop stand-alone thin client applications

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