Yes, I did.

From: Stadelmann Josef [mailto:[email protected]]
Sent: Monday, March 26, 2012 12:11 PM
To: [email protected]
Subject: AW: Can't access SOAP header

Have you engaged addressing.mar on client and service?
Josef

Von: [email protected] [mailto:[email protected]]
Gesendet: Montag, 26. März 2012 16:50
An: [email protected]
Betreff: Can't access SOAP header

Hello all,

My web service client passes a custom SOAP header to the service. The 
SOAPMonitor shows that it is included <soapenv:Header> element.
On the server side I'm attempting to get it using this bit of code:

MessageContext ctx = MessageContext.getCurrentMessageContext();

OperationContext opctx = ctx.getOperationContext();
try {
                MessageContext msgctx = 
opctx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
                AxisMessage message = msgctx.getAxisMessage();
                 ArrayList headers = message.getSoapHeaders();
} catch (AxisFault e) {
                log.debug("Failed getting incoming message context", e);
}

But the headers list is empty.

I'm using Axis 1.6.1. According to various document I found on the net, I 
should be able to get the SOAP message from the message context, SOAP envelope 
from the SOAP message and from that get the headers but 
org.apache.axis2.context.MessageContext allows me to get only to AxisMessage, 
which does not provide the means to get the SOAP envelope. Please advise what I 
am doing wrong and what is the correct way. Thanks,

-a

Reply via email to