[ 
https://issues.apache.org/jira/browse/CXF-7682?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16454425#comment-16454425
 ] 

ASF GitHub Bot commented on CXF-7682:
-------------------------------------

dkulp commented on issue #394: CXF-7682: 
context.get(MessageContext.HTTP_REQUEST_HEADERS) always ret…
URL: https://github.com/apache/cxf/pull/394#issuecomment-384693086
 
 
   Merging, lgtm.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> context.get(MessageContext.HTTP_REQUEST_HEADERS) always returns null for 
> client
> -------------------------------------------------------------------------------
>
>                 Key: CXF-7682
>                 URL: https://issues.apache.org/jira/browse/CXF-7682
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>            Reporter: Jimmy Praet
>            Priority: Major
>
> I have a client-side LogicalHandler that adds some HTTP headers and am 
> noticing it causes the existing SOAPAction HTTP header (already added 
> automatically by the JAX-WS runtime) to be removed.
> My handler code looks like this:
> {code:java}
> public boolean handleMessage(LogicalMessageContext context) {
>   Boolean outbound = (Boolean) 
> context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
>   if (outbound) {
>     Map<String, List<String>> headers =
>         (Map<String, List<String>>) 
> context.get(MessageContext.HTTP_REQUEST_HEADERS);
>     if (headers == null) {
>       headers = new HashMap<String, List<String>>();
>       context.put(MessageContext.HTTP_REQUEST_HEADERS, headers);
>     }
>     for (Map.Entry<String, String> entry : Tracer.getEntries().entrySet()) {
>       headers.put(entry.getKey(), 
> Collections.singletonList(entry.getValue()));
>     }
>   }
>   return true;
> }
> {code}
> I had a quick look at the code and noticed the 
> [LogicalMessageContextImpl#get(Object) 
> |https://github.com/apache/cxf/blob/a36af6323505211479c875fb9923cc6dcbc6ac95/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageContextImpl.java#L53]
>  always returns null on the client side (isRequestor() = true).
> So my handler will create a new header map and put it on the context, which 
> is internally mapped to key "org.apache.cxf.message.Message.PROTOCOL_HEADERS" 
> [here|https://github.com/apache/cxf/blob/master/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedMessageContext.java#L462].



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to