Develop a Web service from an enterprise bean

This task explains how to develop a Web service from an enterprise bean.

 

Before you begin

Set up a Web services development and unmanaged client run-time environment.

This task is one of four ways that one can develop a Web service. We can also develop a Web service from a Java bean, develop a Web service with an existing Web Services Description Language (WSDL) file using a Java bean, or develop a Web service with an existing WSDL file using an enterprise bean. In this task, we need develop a new WSDL file.

Enabling the enterprise bean for Web services includes developing the service endpoint interface, locating or developing a WSDL file that is the engine of the Web service, generating and configuring the deployment descriptors, completing the EJB implementation, assembling all the artifacts required for the Web service, enabling the modules and deploying the application into the WebSphere Application Server environment.

To use an enterprise bean as the basis for a Web service implementation, follow these requirements:

  • The enterprise bean must be a stateless session bean.

  • Web service method parameters must be one of the supported Java API for XML-based remote procedure call (JAX-RPC) types.

These requirements are documented in the JAX-RPC specification available through Web services: Resources for learning.

 

Overview

Create the artifacts that enable the enterprise bean to be a Web service and assemble the artifacts into the enterprise application:

 

Procedure

  1. Access an existing JAR file to use as a Web service. Verify the enterprise bean meets the requirements.

  2. Develop an Enterprise JavaBeans (EJB) service endpoint interface. The service endpoint interface defines which enterprise bean methods should be made available as a Web service.

  3. Develop a Web Services Description Language (WSDL) file. The WSDL file is the engine of a J2EE Web service; without it there is no Web service.

  4. Develop Web services deployment descriptor templates from an EJB implementation. You need to complete this step to create the deployment descriptor templates that are configured to map the service implementation to the EJB implementation.

  5. Complete the EJB implementation.

  6. Configure the webservices.xml deployment descriptor. Configure the webservices.xml deployment descriptor so that WAS can process the incoming Web services requests.

  7. Configure the ibm-webservices-bnd.xmi deployment descriptor. Configure the ibm-webservices-bnd.xml deployment descriptor so that WAS can process the incoming Web services requests.

  8. Assemble a JAR file that is enabled for Web services from an enterprise bean. This article explains how to assemble the artifacts required to enable the EJB module for Web services into the JAR file.

  9. Assemble a Web services-enabled enterprise bean JAR file into an EAR file. This topic explains how to assemble the artifacts required for Web services into to the EAR file.

  10. Enable the EAR file. When the EAR file contains EJB modules, it must have the Web services endpoint WAR file added with the endptEnabler tool before it is deployed.

  11. Deploy the EAR file into WebSphere Application Server.

    This topic presents the steps necessary to deploy the EAR file that has been configured, assembled and enabled for Web services.

 

Result

You have a Web service developed from a stateless session enterprise bean.

 

What to do next

Publish the WSDL file.

 

See also


Developing a service endpoint interface from an EJB
Developing Web services deployment descriptor templates for an EJB implementation
Completing the EJB implementation

 

Related Tasks


Developing a WSDL file
Assembling a JAR file that is enabled for Web services from an enterprise bean
Assembling an enterprise bean JAR file into an EAR file
Enabling an EAR file for Web services
Deploying Web services
Developing new Web services from an existing WSDL file using an EJB implementation

 

See Also


Artifacts used to develop Web services
Web services: Resources for learning