cxfendpoint change WS-Addressing namespace to 2005/08 and removal of Offer in CreateSequence

357 Views Asked by At

I hope it is ok to ask two somehow related Questions in one. I am using a camel route to send a SOAP message to a webservice using Reliable Messaging. Now there is two Problems i ran into, first the WS-Addressing version that is used is wrong, i need to have 2005/08 but instead it is using 2004/08.

For setting up the endpoint i am using (shortend a bit)

CxfEndpoint cxfEndpoint = new CxfEndpoint();
cxfEndpoint.setWsdlURL(getWsdlURL());
cxfEndpoint.setDataFormat(DataFormat.CXF_MESSAGE);
cxfEndpoint.setCamelContext(camelContext);  
camelContext.addEndpoint(outEndpoint.getId(), cxfEndpoint);

I also set up a cxfbus in the camel-context.xml file and a seperate http-conduit.xml

now my question for the WS-Addressing is, how can i change it to use WS-Addressing 2005/08? i already tried to add following to my route, before the endpoint is called, but it did not change the Addressing Namespace.

.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
    AddressingPropertiesImpl addrProps =
                new AddressingPropertiesImpl("http://www.w3.org/2005/08/addressing");
    Map<String, Object> requestContext = new HashMap<String, Object>();
    requestContext.put("javax.xml.ws.addressing.context", addrProps);
    exchange.getIn().setHeader(Client.REQUEST_CONTEXT, requestContext);  
    }
})

Regarding the Offer in the CreateSequence added the following before the endpoint is added to the CamelContext:

  RMManager rmManager = cxfEndpoint.getBus().getExtension(RMManager.class);
  rmManager.getSourcePolicy().setIncludeOffer(false);

Although this worked fine it had the nasty side effect that my http-conduit was no longer used. I fixed this with following:

  cxfEndpoint.setBus(bus);

where bus is being @Autowired

but in my opinion this broke the WS-Reliable Messaging for my incoming CXF Endpoint that are created in a similiar way. It still sends the correct messages but before the CreateSequenceResponse is send, there is an empty SOAP message sent, that causes the client to drop out of the Sequence creation.

Now my question would be, is there a better way to remove the Offer from the CreateSequence?

0

There are 0 best solutions below