Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

If you're using WS-Policy, CXF can automatically set up WS-Addressing for you if you use the <Addressing> policy expression.

Decoupled responses

By default, WS-Addressing using anonymous Reply-To addresses. This means the request/response patterns are synchronous in nature and the response is sent back via the normal reply channel. However, WS-Addressing allows for a decoupled endpoint to be used for receiving the response and CXF will then correlate it with the appropriate request. There are a few ways for configuring the address on which CXF will listen for decoupled WS-Addressing responses.

HTTP Conduit configuration

The HTTP Conduit's client configuration has an option for a DecoupledEndpoint address. If the conduit has this configured, all requests sent via that conduit that have WS-Addressing enabled will have their responses sent to that endpoint:

Code Block
xml
xml

    <http:conduit name="{http://apache.org/hello_world_soap_http}SoapPort.http-conduit">
      <http:client DecoupledEndpoint="http://localhost:9090/decoupled_endpoint"/>
    </http:conduit>

Request Property

The address can be set via a Request Context property.

Code Block
java
java

((BindingProvider)proxy).getRequestContext()
    .put("org.apache.cxf.ws.addressing.replyto", "http://localhost:9090/decoupled_endpoint");

AddressingProperties

The CXF org.apache.cxf.ws.addressing.impl.AddressingPropertiesImpl object can be used to control many aspects of WS-Addressing including the Reply-To:

Code Block
java
java

        AddressingProperties maps = new AddressingPropertiesImpl();
        EndpointReferenceType ref = new EndpointReferenceType();
        AttributedURIType add = new AttributedURIType();
        add.setValue("http://localhost:9090/decoupled_endpoint");
        ref.setAddress(add);
        maps.setReplyTo(ref);
        maps.setFaultTo(ref);

        ((BindingProvider)port).getRequestContext()
            .put("javax.xml.ws.addressing.context", maps);