+

Search Tips   |   Advanced Search

Implement Web services applications with JAX-RPC


Use the JAX-RPC model to develop Web services.

Best practice: IBM WAS supports the JAX-WS model and the JAX-RPC model. JAX-WS is the next generation Web services model extending the foundation provided by the JAX-RPC model. Using the strategic JAX-WS model, development of Web services and clients is simplified through support of a standards-based annotations model. Although the JAX-RPC model and applications are still supported, take advantage of the easy-to-implement JAX-WS model to develop new Web services applications and clients. bprac

To develop Web services based on the JAX-RPC programming model, we can use a bottom-up development approach starting from existing Java Beansor enterprise beans or we can use a top-down development approach starting with an existing WSDL file. This task describes the steps when using the bottom-up development approach.

When developing a JAX-RPC Web service starting from existing Java Beans or enterprise beans, we need develop a WSDL file. Use existing Java Beans or enterprise beans and then enable the implementation for Web services. Enabling the bean for Web services includes developing the service endpoint interface, developing a WSDL file that is the description of the Web service, generating and configuring the deployment descriptors, assembling all artifacts required for the Web service, and deploying the application onto the appserver.

Considerations when using Java Beans

Java Beans exposed as JAX-RPC Web services are supported only over an HTTP transport.

Considerations when using enterprise beans

  • The enterprise bean must be a stateless session bean.
  • Enterprise beans that are exposed as JAX-RPC Web services must be packaged in EJB 2.1 or in EJB 3.0 or higher modules.

  • For JAX-RPC Web services using EJB 2.1 style endpoints, the Web service method parameters must be one of the supported JAX-RPC types. These requirements are documented in the JAX-RPC specification.

  • JAX-RPC Web services using enterprise beans are supported over an HTTP or JMS transport.

Best practice: It is a best practice to use EJB 2.1 style enterprise beans with JAX-RPC applications. bprac

 

  1. Set up a development environment for Web services. You do not have to set up a development environment if we are using Rational Application Developer.

  2. Determine the existing Java Beans or enterprise beans to expose as a JAX-RPC Web service.

  3. Develop a service endpoint interface. The service endpoint interface defines the Java Beans or enterprise beans methods for a particular Web service. The Java Beans must implement methods that have the same signature as the methods on the service endpoint interface.

  4. Develop the Java artifacts.

    1. Develop a WSDL file. The WSDL file is the description of a Java EE Web service. For JAX-RPC applications, a WSDL file is required.

    2. Develop JAX-RPC deployment descriptors. Use the WSDL2Java command-line tool to create the deployment descriptor templates that are configured to map the service implementation to the Java Beans or enterprise beans implementation.

  5. Complete the implementation of the Web service application.

  6. Set the webservices.xml deployment descriptor. For JAX-RPC Web services, configure the webservices.xml deployment descriptor so that the appserver can process the incoming Web services requests.
  7. Set the ibm-webservices-bnd.xmi deployment descriptor. Set the ibm-webservices-bnd.xml deployment descriptor so that the appserver can process the incoming Web services requests.
  8. Assemble the artifacts for the Web service.

    Use assembly tools provided with the appserver to assemble the Java -based Web services modules.

    If we have assembled an EAR file that contains enterprise beans modules that contain Web services, use the endptEnabler command-line tool or an assembly tool before deployment to produce a Web services endpoint WAR file. This tool is also used to specify whether the Web services are exposed using SOAP over JMS or SOAP over HTTP.

  9. Deploy the EAR file into the appserver. We can now deploy the EAR file that has been configured and enabled for JAX-RPC Web services onto the appserver.

 

Results

we have developed a JAX-RPC Web service application.

 

Next steps

After you deploy the EAR file, test the Web service to make sure that the service works with the appserver.


Develop a service endpoint interface from Java Beans for JAX-RPC applications
Develop a service endpoint interface from enterprise beans for JAX-RPC applications
Develop a WSDL file for JAX-RPC applications
Develop JAX-RPC Web services deployment descriptor templates for a Java Beans implementation
Develop JAX-RPC Web services deployment descriptor templates for an enterprise bean implementation
Completing the Java Beans implementation for JAX-RPC applications
Completing the EJB implementation for JAX-RPC applications
Set the webservices.xml deployment descriptor for JAX-RPC Web services
Set the webservices.xml deployment descriptor for handler classes
Set the ibm-webservices-bnd.xmi deployment descriptor for JAX-RPC Web services
Use WSDL EJB bindings to invoke an EJB from a JAX-RPC Web services client
Example: Deploying a JAX-RPC Web service from an existing application

 

Related concepts


JAX-RPC
Web services

 

Related tasks


Set up a development environment for Web services
Assemble Web services applications
Assembling a WAR file that is enabled for Web services from Java code
Assembling a Web services-enabled WAR into an EAR file
Deploy Web services applications onto appservers
Use HTTP to transport Web services
Use SOAP over Java Message Service to transport Web services

 

Related


Artifacts used to develop Web services
Web services specifications and APIs