Debugging through the code illustrates that you can't just set this property on 
the MessageContext object for the Provider, you must set it on the outbound 
message object, like this:
((org.apache.cxf.jaxws.context.WrappedMessageContext)messageContext).getWrappedMessage().getExchange().getOutMessage().put(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND,
 wsaServer);

So the working code for me becomes something like:
AddressingProperties wsaServer = new AddressingPropertiesImpl();
AttributedURIType aut = new AttributedURIType();
aut.setValue("urn:get:some");
wsaServer.setAction(aut);
((org.apache.cxf.jaxws.context.WrappedMessageContext)messageContext).getWrappedMessage().getExchange().getOutMessage().put(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND,
 wsaServer);

I've tried overriding the message id and the action headers, both were 
successful.  Still, I'm wondering if it's a bug to have to jump through all 
these hoops to set that on the outbound message.  Shouldn't it inherit from the 
MessageContext or something?  The outbound message seems to get the inbound 
addressing properties assigned just fine.

Thanks,
Jesse

-----Original Message-----
From: Jesse Pangburn [mailto:jesse.pangb...@us.lawson.com] 
Sent: Wednesday, September 07, 2011 5:24 PM
To: users@cxf.apache.org
Subject: jaxws Provider doesn't allow override of outbound ws addressing headers

Hi,
I have a jaxws Provider configured to do WS-Addressing and the defaults seem to 
work fine.  However, if I try to override some of the WS-Addressing headers in 
the MessageContext, it gets ignored.  I've tried the following :

AddressingProperties wsaServer = new AddressingPropertiesImpl();
AttributedURIType aut = new AttributedURIType();
aut.setValue("urn:get:some");
wsaServer.setAction(aut);
messageContext.put(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND, 
wsaServer);

But the Action header sent in the response is the default from the WSDL, not my 
override value.  Am I doing something wrong or this never worked?  I've tried 
doing:
messageContext.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND)

But that returns null, so I've been using the put instead.  I tried overriding 
the messageId as well, but that didn't work either.

Thanks,
Jesse



Reply via email to