[ https://issues.apache.org/jira/browse/CXF-7682?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dennis Kieselhorst resolved CXF-7682. ------------------------------------- Resolution: Fixed Fix Version/s: 3.2.5 3.1.16 > 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 > Fix For: 3.1.16, 3.2.5 > > > 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)