Contact Us 1-800-596-4880

Enabling WS-Addressing

CXF supports the 2004-08 and 1.0 versions of WS-Addressing. To enable WS-Addressing on your services, you must configure the CXF service to use the WS-Adressing feature:

<cxf:jaxws-service ... >
  <cxf:features>
    <wsa:addressing />
  </cxf:features>
</cxf:jaxws-service/>

This works with clients as well:

<cxf:jaxws-client ... >
  <cxf:features>
    <wsa:addressing />
  </cxf:features>
</cxf:jaxws-client/>

Enabling WS-Addressing Globally

To enable WS-Addressing globally, there are two steps. First, create an external configuration file with the following:

<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:cxf="http://cxf.apache.org/core"
  xmlns:wsa="http://cxf.apache.org/ws/addressing"
  xmlns:wsrm-mgr="http://cxf.apache.org/ws/rm/manager"
  xsi:schemaLocation="
    http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
    http://schemas.xmlsoap.org/ws/2005/02/rm/policy http://schemas.xmlsoap.org/ws/2005/02/rm/wsrm-policy.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

  <cxf:bus>
    <cxf:features>
      <wsa:addressing/>
    </cxf:features>
  </cxf:bus>

</beans>

Second, you’ll need to tell the CXF module to use this configuration file:

<mule xmlns="http://www.mulesoft.org/schema/mule/core"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:spring="http://www.springframework.org/schema/beans"
  xmlns:quartz="http://www.mulesoft.org/schema/mule/quartz"
  xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf"
  xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd
       http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/3.1/mule-cxf.xsd
       http://www.mulesoft.org/schema/mule/quartz http://www.mulesoft.org/schema/mule/quartz/3.1/mule-quartz.xsd">

    <cxf:configuration configurationLocation="myConfig.xml"/>
...
</mule>

Asynchronous Reply To Destinations

NOTE: This requires Mule 3.1.

To set up an asynchronous reply to destination for you client, you can set the "decoupledEndpoint" attribute property on your client message processor.

<cxf:jaxws-client ... decoupledEndpoint="http://localhost:8888/myReplydestination">
  <cxf:features>
    <wsa:addressing />
  </cxf:features>
</cxf:jaxws-client/>

The URL in the decoupledEndpoint property will be used as your reply to destination for all messages.

Manipulating WS-Addressing Headers

To manipulate the WS-Addressing headers inside the messages, you can write a JAX-WS handler or a CXF interceptor. For a quick start, see the WS-Addressing sample inside the CXF distribution.