Implementing Web services applications with JAX-WS

When starting from existing JavaBeans™ or enterprise beans, you can use a bottom-up approach to developing Web services based on the Java™ API for XML-Based Web Services (JAX-WS) programming model.

Before you begin

Best practice: IBM® WebSphere® Application Server supports the Java API for XML-Based Web Services (JAX-WS) programming model and the Java API for XML-based RPC (JAX-RPC) programming model. JAX-WS is the next generation Web services programming model extending the foundation provided by the 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. bprac

About this task

To develop Web services based on the JAX-WS programming model, you can use a bottom-up development approach starting from existing JavaBeans or enterprise beans or you can use a top-down development approach starting with an existing Web Services Description Language (WSDL) file. This task describes the steps when using the bottom-up development approach.

When developing JAX-WS Web services starting from existing JavaBeans or enterprise beans, you can expose the bean as a JAX-WS Web service by using annotations. Adding the @WebService or @WebServiceProvider annotation to the bean defines the bean as a JAX-WS Web service. JAX-WS Web services can optionally use a service endpoint interface. In addition to annotating the bean and the optional service endpoint interface, you must assemble all the artifacts that the Web service requires, and deploy the resulting application into the application server environment to complete the process of enabling the bean as a Web service. Although the use of a WSDL file is considered a best practice, you are not required to package a WSDL file with your JAX-WS Web services.

Considerations when using JavaBeans

JavaBeans exposed as JAX-WS 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-WS Web services must be packaged in EJB 3.0 or higher modules.
  • JAX-WS applications containing enterprise beans must be deployed with the endptEnabler command.
  • JAX-WS Web services using enterprise beans are supported over an HTTP or Java Message Service (JMS) transport.
For transitioning users: Starting with WebSphere Application Server Version 7.0, Java EE 5 application modules (Web application modules version 2.5 or above, or EJB modules version 3.0 or above) are scanned for annotations to identify JAX-WS services and clients. However, pre-Java EE 5 application modules (Web application modules version 2.4 or before, or EJB modules version 2.1 or before) are not scanned for JAX-WS annotations, by default, for performance considerations. In the Version 6.1 Feature Pack for Web Services, the default behavior is to scan pre-Java EE 5 Web application modules to identify JAX-WS services and to scan pre-Java EE 5 Web application modules and EJB modules for service clients during application installation. Because the default behavior for WebSphere Application Server Version 7.0 is to not scan pre-Java EE 5 modules for annotations during application installation or server startup, to preserve backward compatability with the feature pack from previous releases, you must configure either the UseWSFEP61ScanPolicy property in the META-INF/MANIFEST.MF of a Web archive (WAR) file or EJB module or define the Java virtual machine custom property, com.ibm.websphere.webservices.UseWSFEP61ScanPolicy, on servers to request scanning during application installation and server startup. To learn more about annotations scanning, see the JAX-WS annotations information. trns

Procedure

  1. Set up a development environment for Web services.
  2. Determine the existing JavaBeans or enterprise beans that you want to expose as a JAX-WS Web service.
  3. Develop JAX-WS Web services with annotations.
  4. Generate Java artifacts for JAX-WS applications.
  5. (optional) Enable MTOM for JAX-WS Web services.
  6. (optional) Develop and configure a webservices.xml deployment descriptor for JAX-WS applications.
  7. Complete the implementation of your Web services application.
  8. (Optional) Customize URL patterns in the web.xml file.
  9. Assemble the artifacts for your Web service.
  10. Deploy the EAR file into the application server.
  11. Test the Web service to make sure that the service works with the application server.

Results

You have developed a JAX-WS application.




In this information ...


Related concepts

IBM Redbooks, demos, education, and more


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

This feature requires Internet access.



Terms of Use | Feedback

Last updated: Oct 20, 2010 7:46:59 PM CDT
http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/twbs_devwbsjaxws.html