Developing a service endpoint interface from an EJB

You can develop a service endpoint interface from an Enterprise JavaBeans (EJB) for a JAX-RPC Web service.

Before you begin

New or updated for this feature pack Important: The WebSphere® Application Server Version 6.1 Feature Pack for Web Services extends the capabilities of this product to introduce support for the Java API for XML-Based Web Services (JAX-WS) 2.0 programming model. JAX-WS is the next generation Web services programming model complimenting the foundation provided by the Java API for XML-based RPC (JAX-RPC) programming model. Using the strategic JAX-WS programming model, development of Web services and clients is simplified through support of a standards-based annotations model. Although the JAX-RPC programming model and applications are still supported, take advantage of the easy-to-implement JAX-WS programming model to develop new Web services applications and clients.
Supported configurations New or updated for this feature pack Supported configurations: The Feature Pack for Web Services only supports hosting JavaBeans endpoints within the Web container for JAX-WS Web services applications. To develop enterprise beans hosted as Web services, you must use the JAX-RPC programming model. sptcfg
Set up a development environment for Web services.

This task is a required step in developing a Java API for XML-based RPC (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, which is available through Web services: Resources for learning.

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

You can also create a service endpoint interface by using the assembly tools.

About this task

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

Procedure

  1. Create a Java interface that contains the methods that you want to include in the service endpoint interface. If you 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.

    [AIX HP-UX Solaris] Use the Linux and Unix platforms cited in Developing thin application client code.

    [iSeries] Ensure that the j2ee.jar file is in your CLASSPATH to compile the interface. The JAR file is located in the /QIBM/ProdData/WebSphere/AppServer/V6/product/lib/j2ee.jar directory path.

Results

You have a service endpoint interface that you 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 that is 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 that are required to develop a Web service, including the Web Services Description Language (WSDL) file. You need to develop a WSDL file because it is the engine of a Web service; without a WSDL file, you have no Web service.



In this information ...


IBM Redbooks, demos, education, and more

(Index)

Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.

Task topic Task topic    

Terms and conditions for information centers | Feedback

Last updatedLast updated: Aug 31, 2013 1:23:07 AM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=pix&product=was-nd-dist&topic=twbs_devejbsei
File name: twbs_devejbsei.html