You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Jesse Pangburn (JIRA)" <ji...@apache.org> on 2011/09/12 21:25:10 UTC

[jira] [Created] (CXF-3802) jaxws Provider doesn't allow override of outbound ws addressing headers

jaxws Provider doesn't allow override of outbound ws addressing headers
-----------------------------------------------------------------------

                 Key: CXF-3802
                 URL: https://issues.apache.org/jira/browse/CXF-3802
             Project: CXF
          Issue Type: Bug
          Components: JAX-WS Runtime
    Affects Versions: 2.4.2
            Reporter: Jesse Pangburn
            Priority: Minor


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.

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.

Dan suggested the following fix in ContextUtils.  Change these lines:
        AddressingPropertiesImpl maps =
            (AddressingPropertiesImpl)message.get(mapProperty);
        if (maps != null) {
            LOG.log(Level.FINE, "current MAPs {0}", maps);
        }
to:
        AddressingPropertiesImpl maps =
            (AddressingPropertiesImpl)message.get(mapProperty);
        if (maps == null && isOutbound && !isRequestor) {
        	maps = (AddressingPropertiesImpl)message.getExchange().getInMessage().get(mapProperty);
        }
        if (maps != null) {
            LOG.log(Level.FINE, "current MAPs {0}", maps);
        }

I've tested this and it is successful with just the expected messageContext.put() call.  Thanks Dan!

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (CXF-3802) jaxws Provider doesn't allow override of outbound ws addressing headers

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3802?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp reassigned CXF-3802:
--------------------------------

    Assignee: Daniel Kulp

> jaxws Provider doesn't allow override of outbound ws addressing headers
> -----------------------------------------------------------------------
>
>                 Key: CXF-3802
>                 URL: https://issues.apache.org/jira/browse/CXF-3802
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 2.4.2
>            Reporter: Jesse Pangburn
>            Assignee: Daniel Kulp
>            Priority: Minor
>              Labels: jaxws, provider, ws-addressing
>
> 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.
> 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.
> Dan suggested the following fix in ContextUtils.  Change these lines:
>         AddressingPropertiesImpl maps =
>             (AddressingPropertiesImpl)message.get(mapProperty);
>         if (maps != null) {
>             LOG.log(Level.FINE, "current MAPs {0}", maps);
>         }
> to:
>         AddressingPropertiesImpl maps =
>             (AddressingPropertiesImpl)message.get(mapProperty);
>         if (maps == null && isOutbound && !isRequestor) {
>         	maps = (AddressingPropertiesImpl)message.getExchange().getInMessage().get(mapProperty);
>         }
>         if (maps != null) {
>             LOG.log(Level.FINE, "current MAPs {0}", maps);
>         }
> I've tested this and it is successful with just the expected messageContext.put() call.  Thanks Dan!

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (CXF-3802) jaxws Provider doesn't allow override of outbound ws addressing headers

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3802?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-3802.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.4.3
                   2.3.7

> jaxws Provider doesn't allow override of outbound ws addressing headers
> -----------------------------------------------------------------------
>
>                 Key: CXF-3802
>                 URL: https://issues.apache.org/jira/browse/CXF-3802
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 2.4.2
>            Reporter: Jesse Pangburn
>            Assignee: Daniel Kulp
>            Priority: Minor
>              Labels: jaxws, provider, ws-addressing
>             Fix For: 2.3.7, 2.4.3
>
>
> 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.
> 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.
> Dan suggested the following fix in ContextUtils.  Change these lines:
>         AddressingPropertiesImpl maps =
>             (AddressingPropertiesImpl)message.get(mapProperty);
>         if (maps != null) {
>             LOG.log(Level.FINE, "current MAPs {0}", maps);
>         }
> to:
>         AddressingPropertiesImpl maps =
>             (AddressingPropertiesImpl)message.get(mapProperty);
>         if (maps == null && isOutbound && !isRequestor) {
>         	maps = (AddressingPropertiesImpl)message.getExchange().getInMessage().get(mapProperty);
>         }
>         if (maps != null) {
>             LOG.log(Level.FINE, "current MAPs {0}", maps);
>         }
> I've tested this and it is successful with just the expected messageContext.put() call.  Thanks Dan!

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira