Enabling Web Services Addressing support for JAX-WS applications using deployment descriptors

For JAX-WS applications, you can enable WS-Addressing support during the packaging of either a service or client application, by editing the deployment descriptor for that application.

About this task

To modify WS-Addressing behavior by using deployment descriptors, add an <addressing> element to the deployment descriptor file for the application. The <addressing> element has optional child elements as described in the following table.

The <addressing> element functions in the same way as the Addressing annotation. The child elements of the <addressing> annotation function in the same way as the parameters of the Addressing annotation.

Table 1. Child elements of the addressing deployment descriptor element . The table lists the different child elements with their possible values and a description of each one.
Element name Possible values Description
enabled
true (default)
false
Whether WS-Addressing support is enabled.
required
true
false (default)
Whether WS-Addressing headers are required.
responses
All (default)
ANONYMOUS
NON_ANONYMOUS
Whether to use a synchronous or an asynchronous message exchange pattern. Specify ANONYMOUS to send messages in a synchronous message pattern; use NON_ANONYMOUS to send messages in an asynchronous message exchange pattern.

Procedure

  • To modify the behavior of the WS-Addressing support in the service application, add the <addressing> element, and optional child elements as required, to the service deployment descriptor under the <port-component> element within the <webservice-description> element.
    In the following example, the Addressing deployment descriptor fragment specifies that WS-Addressing is enabled and required, and that the asynchronous message exchange pattern is used.
    <port-component>
         <port-component-name>MyPort1</port-component-name>
            <addressing>
             <enabled>true</enabled>
             <required>true</required>
             <responses>NON_ANONYMOUS</responses>
            </addressing>
            <service-impl-bean>
               <servlet-link>MyPort1ImplBean</servlet-link>
            </service-impl-bean>
    </port-component>
  • To modify the behavior of the WS-Addressing support in the client application, add the <addressing> element, and optional child elements as required, to the client deployment descriptor under the <port-component-ref> element within the <service-ref> element.
    For example, the following deployment descriptor fragment indicates that WS-Addressing is enabled:
    <service-ref>
            <service-ref-name>service/MyPortComponentRef</service-ref-name>
            <service-interface>com.example.MyService</service-ref-interface>
            <port-component-ref>
               <service-endpoint-interface>com.example.MyPortType</service-endpoint-interface>
               <addressing>
                  <enabled>true</enabled>
               </addressing>
            </port-component-ref>
    </service-ref>

Results

WS-Addressing properties are now included in the SOAP message header, and are processed by the server on receipt of the message.