This might be a simple enhancement request. Are you able to build CXF source
and test? I think a simple change like:
--- a/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
+++ b/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
@@ -279,6 +279,9 @@ public final class ContextUtils {
mapProperty);
AddressingPropertiesImpl maps =
(AddressingPropertiesImpl)message.get(mapProperty);
+ if (maps == null && isOutbound && !isRequestor) {
+ message.getExchange().getInMessage().get(mapProperty);
+ }
if (maps != null) {
LOG.log(Level.FINE, "current MAPs {0}", maps);
} else if (!isProviderContext) {
would work in this case. Basically, on the outbound server side, if the
message doesn't have the map with the key, check the inbound message (where
the JAX-WS context would have stored it).
Dan
On Wednesday, September 07, 2011 9:26:31 PM Jesse Pangburn wrote:
> 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).getWra
> ppedMessage().getExchange().getOutMessage().put(JAXWSAConstants.SERVER_ADDRE
> SSING_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).getWrap
> pedMessage().getExchange().getOutMessage().put(JAXWSAConstants.SERVER_ADDRES
> SING_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:[email protected]]
> Sent: Wednesday, September 07, 2011 5:24 PM
> To: [email protected]
> 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
--
Daniel Kulp
[email protected]
http://dankulp.com/blog
Talend - http://www.talend.com