Task overview: Implementing Web services applications

Use this topic as an introduction to using Web services. WebSphere® Application Server supports Web services that are developed and implemented based on a variety of Java programming models. Use Web services when operating across a variety of platforms, including Java Platform, Enterprise Edition (Java EE) and non-Java EE platforms.

Before you begin

Decide if a Web services implementation benefits your business process.

About this task

Best practice 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

For a complete list of the supported standards and specifications, see the Web services specifications and API documentation.

Implementing Web services applications is an easy way to integrate application systems together within or outside your business infrastructure that function as stand-alone systems. For example, your customer information database is a stand-alone application, but you want your accounting application to access the customer data. You can create a Web service for the customer database and then enable the accounting application as a Web service client. The accounting application can now access the customer information. By implementing a Web service, these two applications can share information in an efficient way.

Because Web services are easily applied to existing applications and information technology assets, you can develop, deploy and recompose new solutions quickly to address new opportunities. As Web services become more popular, the pool of services grows, promoting development of more robust models of just-in-time application and business integration over the Internet.

You can use Web services applications with the application server by following the steps provided:

Procedure

  1. Plan to use Web services. Review all of the components of Web services to learn how you can make your Web services plan more robust.
  2. (Optional) Migrate existing Web services.

    Because Java EE environments emphasize compatibility, most application servers that offer support for the newer JAX-WS and JAXB specifications continue to support the older JAX-RPC specification. A consequence of this is that, existing Web services are likely to remain JAX-RPC based while new ones are developed using JAX-WS and JAXB.

    However, as time passes and applications are revised and rewritten, there might be times when the best strategy is to migrate a JAX-RPC based Web service to one based on JAX-WS and JAXB. This might result from a vendor choosing to provide enhancements to qualities of service that are only available in the new programming models. For example, SOAP 1.2 and SOAP Message Transmission Optimization Mechanism (MTOM) support are only available within the JAX-WS 2.x and JAXB 2.x programming models and not JAX-RPC. Read about Web services migration best practices to learn more about best practices and examples when migrating JAX-RPC Web services to JAX-WS and JAXB Web services.

    Note: Existing JAX-RPC applications wanting to use JAX-WS features must be rewritten using the JAX-WS programming model.

    If you have used Web services based on Apache SOAP and now want to develop and implement Web Services for Java EE specification, you need to migrate client applications developed with all versions of 4.0, and versions of 5.0 prior to 5.0.2. To learn more, see the migrating Apache SOAP Web services to JAX-RPC Web Services based on Java EE standards information.

  3. Develop Web services applications. You can develop Web services in one of the following ways:
    1. Develop Web services from existing WSDL files using JAX-WS.

      You can create a JAX-WS Web service by starting with an existing Web Services Description Language (WSDL) file describing the service interface for a JavaBeans or enterprise beans application. Typically, the WSDL file is defined as part of the application modeling process. Using an existing service definition or WSDL file to generate a new application is called a top-down approach to developing Web services.

    2. Develop Web services applications using JAX-WS.

      You can use the Java API for XML-Based Web Services (JAX-WS) programming model to develop Web services. JAX-WS simplifies application development through a standard, annotation-based model to develop Web services applications and clients. A common set of binding rules for XML and Java objects make it easy to incorporate XML data and process functions in Java applications. A further set of enhancements help you optimally send binary attachments, such as images or files, with the Web services requests.

      When developing a JAX-WS Web service starting from existing JavaBeans or stateless session 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. Enterprise beans that are exposed as JAX-WS Web services must be packaged in EJB 3.0 or higher modules.

      Transforming an existing application into Web services is called a bottoms-up approach to developing Web services. This process is called bottoms-up because you are starting with the implementation rather than starting with an existing service or Web Services Description Language (WSDL) file.

    3. Develop and deploy JAX-WS Web services clients Web services clients that can both access and invoke JAX-WS Web services are developed based on the Web Services for Java Platform, Enterprise Edition (Java EE) specification. The application server supports Enterprise JavaBeans™ (EJB) clients, Java EE application clients, JavaServer Pages (JSP) files and servlets that are based on the JAX-WS programming model.
    4. Develop Web services applications from existing WSDL files with JAX-RPC.

      You can create a JAX-RPC Web service by starting with an existing WSDL file describing the service interface of an enterprise bean implementation using a top-down approach to developing Web services.

    5. Develop Web services applications with JAX-RPC.

      You can use the Java API for XML-based RPC (JAX-RPC) programming model to develop Web services. When developing a JAX-RPC Web service starting from existing JavaBeans or enterprise beans, you need develop a WSDL file. You can use existing JavaBeans or enterprise beans and then enable the implementation for Web services.

    6. Develop and deploy JAX-RPC Web services clients You can develop Web services clients based on the Web Services for Java Platform, Enterprise Edition (Java EE) specification and the Java API for XML-based remote procedure call (JAX-RPC) specification. The application server supports Enterprise JavaBeans™ (EJB) clients, Java EE application clients, JavaServer Pages (JSP) files and servlets that are based on the JAX-RPC programming model.
    7. Enable Web services through service integration technologies
      You can use the Web services enablement of the service integration bus to achieve the following goals:
      • Make an internally hosted service that is available at a bus destination available as a Web service.
      • Make an external Web service available internally at a bus destination.
      • Use the Web services gateway to map an existing service, either an internally-hosted service or an external Web service, to a new Web service that is provided by the gateway.

    You can develop Web services to take advantage of Web Services Addressing (WS-Addressing), Web Services Resource Framework (WSRF), and Web Services Transaction (WS-Transaction) support.

    • Use the WS-Addressing SPI: Performing more advanced Web Service Addressing tasks.

      You can develop Web services to take advantage of Web Services Addressing (WS-Addressing), which aids interoperability between Web services using a standard way to address Web services and providing addressing information in messages.

    • Create stateful Web services using the Web Services Resource Framework.

      With the Web Services Resource Framework (WSRF) support in the application server, you can implement a stateful Web service as a WS-Resource, and reference that service it using a WS-Addressing endpoint reference.

    • Use WS-Transaction policy to coordinate transactions or business activities for Web services.

      WS-Transaction is an interoperability standard that includes the WS-AtomicTransaction, WS-BusinessActivity, and WS-Coordination specifications. The Web Services Atomic Transaction (WS-AT) support in the application server provides transactional quality of service to the web services environment. Distributed web services applications, and the resources they use, can take part in distributed global transactions. With Web Services Business Activity (WS-BA) support in the application server, web services on different systems can coordinate activities that are more loosely coupled than atomic transactions. Such activities can be difficult or impossible to roll back atomically, and therefore require a compensation process if an error occurs.

    • Use WS-Policy to exchange policies in a standard format.

      WS-Policy is an interoperability standard that is used to describe and communicate the policies of a Web service so that service providers can export policy requirements in a standard format. Clients can combine the service provider requirements with their own capabilities to establish the policies required for a specific interaction.

  4. Assemble Web services.

    Read about what you need to assemble a Web service and the order in which to assemble the parts, for example an enterprise archive (EAR) file.

  5. Deploy Web services.

    Read about the steps necessary to deploy the EAR file that has been configured and enabled for Web services.

  6. Administer deployed Web services.

    Once your Web services application is deployed, you can configure security settings, view deployment descriptors and WSDL documents, set the scope of a Web service port, and manage policy sets and service providers. These tasks can be done using the administrative console or with command-line tools.

  7. Secure Web services.
  8. Publish the WSDL file.

    After installing a Web services application, and optionally modifying the endpoint information, you might need Web Services Description Language (WSDL) files containing the updated endpoint information. Read about the steps necessary to publish the WSDL files so that this information is available.

  9. Monitor the performance of Web services applications.

    Read about using the Performance Monitoring Infrastructure (PMI) to measure the time required to process Web services requests.

  10. Troubleshoot Web services.

    Read about troubleshooting different processes used to develop, implement and use Web services, including command-line tools, Java compiling errors, client runtime errors and exceptions, serialization and deserialization errors, and authentication challenges and authorization failures with Web services security.

Example

The following example illustrates how a business might use Web services.

The owner of a flower shop wants to start receiving orders from customers through the Web. This owner starts the process by finding wholesale flower suppliers, pricing the product, and completing contracts for future flower orders.

Using Web services, the flower shop owner can find wholesale flower suppliers. One way to find new suppliers is to use a Universal Description, Discovery and Integration (UDDI) registry to search for potential suppliers. When the suppliers are chosen, the registry sends back information on how to contact the flower distributors that meet the criteria of the flower shop owner.

The flower shop owner can request price lists from each of the suppliers by obtaining a WSDL file for each potential supplier. The WSDL can be downloaded from the Web page of the supplier, received through e-mail, or retrieved from the UDDI registry entry of the supplier.

The WSDL describes the procedure call. When using the application server, the procedure call is a JAX-RPC or a JAX-WS procedure call. Either of these procedure call types retrieves the price list. The WSDL file also specifies the Universal Resource Locator (URL), where the request is sent.

The flower shop owner now has to compare the prices received from each supplier, decide which suppliers to do business with, and make arrangements for future orders to fill. The flower shop can now sell merchandise through the Web by using Web services to communicate with suppliers for the best prices and complete the ordering processes. The merchandise price lists need publishing to the Web site and a mechanism is needed for customers to order flowers.

The Web services clients of the flower supplier are deployed on the flower shop server. When a customer makes a transaction to purchase flowers through the Web, the order is sent to the supplier through the procedure call. The supplier responds by sending a confirmation with the order number and shipping date. The suppliers maintain the inventory and the flower shop owner handles billing and customer order management.

Similarly, the flower shop catalog can be composed automatically from the catalogs of each supplier. If the supplier delivers directly to the customer, then the order tracking inquiries can pass directly to the order tracking system of the supplier. The supplier can also use Web services to send invoices for orders by the flower shop. Processes that previously required forms to fill manually, and fax or mail, can now be done automatically, saving labor costs for both the flower shop and the supplier.

Using Web services is beneficial because a much larger inventory is made available to the flower shop. No merchandise maintenance overhead exists, and the flower shop can offer their customers products that they otherwise might not have. Selling flowers through the Web increases capital for the flower shop without overhead of another store or resources invested into additional products.

For a more detailed scenario, see the information for the Web services scenario overview which tells the story of a fictional online garden supply retailer, Plants by WebSphere, and how they incorporated the Web services concept.

Refer to the Samples Gallery for additional Samples that demonstrate JAX-WS and JAX-RPC Web services.




In this information ...


Subtopics

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: Jun 11, 2013 8:40:09 AM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=v701sca&product=was-nd-mp&topic=twbs_usewbs
File name: twbs_usewbs.html