JBoss Web Services inherits full WS-Addressing capabilities from the underlying Apache CXF implementation. Apache CXF provides support for 2004-08 and 1.0 versions of WS-Addressing.
WS-Addressing can be turned on in multiple standard ways:
- consuming a WSDL contract that specifies a WS-Addressing assertion / policy
- using the @javax.xml.ws.soap.Addressing annotation
- using the javax.xml.ws.soap.AddressingFeature feature
|The supported addressing policy elements are:|
Alternatively, Apache CXF proprietary ways are also available:
- specifying the [http://cxf.apache.org/ws/addressing]addressing feature for a given client/endpoint
- using the org.apache.cxf.ws.addressing.WSAddressingFeature feature through the API
- manually configuring the Apache CXF addressing interceptors (org.apache.cxf.ws.addressing.MAPAggregator and org.apache.cxf.ws.addressing.soap.MAPCodec)
- setting the org.apache.cxf.ws.addressing.using property in the message context
The WS-Addressing support is also perfectly integrated with the Apache CXF WS-Policy engine.
This basically means that the WSDL contract generation for code-first endpoint deployment is policy-aware: users can annotate endpoints with the @javax.xml.ws.soap.Addressing annotation and expect the published WSDL contract to contain proper WS-Addressing policy (assuming no wsdlLocation is specified in the endpoint's @WebService annotation).
Similarly, on client side users do not need to manually specify the javax.xml.ws.soap.AddressingFeature feature, as the policy engine is able to properly process the WS-Addressing policy in the consumed WSDL and turn on addressing as requested.
Here is an example showing how to simply enable WS-Addressing through WS-Policy.
A simple JAX-WS endpoint is prepared using a java-first approach; WS-Addressing is enforced through @Addressing annotation and no wsdlLocation is provided in @WebService:
The WSDL contract that's generated at deploy time and published looks like this:
Since the WS-Policy engine is on by default, the client side code is basically a pure JAX-WS client app: