Provides JAX-WS 2.1 support for ws-addressing in the WebSphere application Server V7

Source: Internet
Author: User
Tags websphere application server

IBM WebSphere Application Server V7 includes support for the Java API for xml-based Web Services (JAX-WS) 2.1 specification. JAX-WS 2.1 is a maintenance version of Java specification Request (JSR) 224, which extends the functionality provided by the JAX-WS 2.0 specification by adding new functionality. One of the most important new features is the support of Web Services Addressing (ws-addressing) in the Application programming interface (application Programming Interface,api). In this article, we'll learn how to use this new ws-addressing support and how to help Web service developers simplify the development of stateful Web services.

Brief introduction

Java™api for xml-based Web Services (JAX-WS) replaces the previous standard Java API for XML Based RPC (JAX-RPC). JAX-RPC 1.0 and JAX-RPC 1.1 define APIs and conventions for WEB service calls that support Remote Procedure call (RPC) style. Since then, however, Web services have begun to evolve toward a more document-oriented style. JAX-WS 2.0 provides a completely different application programming interface (API) and conventions to support updated style Web service interactions. It also focuses on simplifying the experience of developers when writing WEB services applications. See the Resources section for links to articles detailing the differences between Jax-ws and Jax-RPC.

Jax-ws 2.1 inherits the simplified trend starting with JAX-WS 2.0, making it easier for developers to write stateful Web services. This is achieved by adding explicit Web Services Addressing (ws-addressing) support to the Jax-ws API. In this article, we'll give you a sample application that shows how to use these new APIs to write stateful Web services, but first we'll look at the new APIs related to ws-addressing in more detail.

Before we begin, however, we need to point out that the JAX-WS 2.1 specification only supports Ws-addressing 1.0 Core and simple Object Access Protocol (SOAP) Binding specifications. If you need to support different versions of the Ws-addressing specification, the JAX-WS 2.1 specification also provides vendors with the ability to extend the API. In Ibm®websphere®application Server V7, we took advantage of this capability to support the older Ws-addressing member submission specification (see Resources). These extensions will also be covered in this article.

Endpoint Reference

The JAX-WS 2.1 specification introduces the concept of endpoint references (endpoint reference). The endpoint reference encapsulates all the details needed to successfully locate the WEB service endpoint. The API introduces a new class, EndpointReference, to represent an endpoint reference. However, the class is not used directly by the developer, but should use its subclasses.

The JAX-WS 2.1 API includes a subclass of EndpointReference named W3cendpointreference. Its role is to represent an endpoint reference based on the requirements of the Ws-addressing 1.0 Core specification. In the WebSphere application Server V7, we provide another subclass submissionendpointreference, which is used to represent an endpoint reference based on the Ws-addressing member submission specification. The relationship between these two classes is shown in Figure 1.

Figure 1. Endpoint Relationships

The JAX-WS 2.1 specification also defines a variety of methods for creating endpoint references in an application. The code fragment in Listing 1 shows one of these methods using the W3cendpointreferencebuilder class. For clarity, we have omitted some details in the following example, but we can get a complete example from the application at the end of this article.

Listing 1. JAX-WS 2.1 Sample

import org.w3c.dom.Element;
import javax.xml.ws.wsaddressing.W3CEndpointReference;
import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;

String address = ...
Element referenceParameter = ...

W3CEndpointReferenceBuilder builder =
   new W3CEndpointReferenceBuilder();
builder.address(address);
builder.referenceParameter(referenceParameter);
W3CEndpointReference epr = builder.build();

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.