Enable Web Services Addressing support for JAX-WS applications using deployment descriptors
For JAX-WS applications, we can enable WS-Addressing support during the packaging of either a service or client application, by editing the deployment descriptor for that application.
To modify WS-Addressing behavior 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.
Element name Possible values Description enabled true (default)
falseWhether WS-Addressing support is enabled. required true
false (default)Whether WS-Addressing headers are required. responses All (default)
ANONYMOUS
NON_ANONYMOUSWhether 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.
Tasks
- 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>
WS-Addressing properties are now included in the SOAP message header, and are processed by the server on receipt of the message.
Developing deployment descriptors for a JAX-WS client Developing a webservices.xml deployment descriptor for JAX-WS applications