LogicalMessageContext.get(MessageContext.HTTP_REQUEST_HEADERS) always returns null on client-side.
Issue
- Application has below client-side JAX-WS LogicalHandler that adds some HTTP request headers:
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;
}
- But this causes the SOAPAction HTTP header that is already set automatically by the JAX-WS runtime to be removed. The underlying issue seems to be that
logicalMessageContext.get(MessageContext.HTTP_REQUEST_HEADERS)
always returns null on the client-side. For SOAPHandlers it works correctly.
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 7.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.