Developing a service endpoint interface for a JavaBeans implementation

 

Developing a service endpoint interface for a JavaBeans implementation

This task explains how to develop a service endpoint interface if you are developing a Web service from a JavaBeans implementation.

You need to set up a Web services development and unmanaged client run-time environment and access an existing Java bean Web archive (WAR) file.

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

The service endpoint interface defines the methods for particular 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 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 tools. Develop a service endpoint interface for a JavaBeans implementation by following the actions listed:

  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 JAX-RPC.

  2. Compile the interface.
    You need /QIBM/ProdData/WebSphere/AppServer/V6/product/lib/j2ee.jar in your CLASSPATH to compile the interface (where product is either Base or ND).

ResultYou have developed a service endpoint interface that you can use to develop Web services.

Example

This example uses an AddressBook Java interface. 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 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 do not have a Web service.


Related tasks
Developing a Web service from a Java bean

Related reference
Artifacts used to develop Web services



Searchable topic ID: twbs_devbeansei