top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to parse SOAP headers inside an Endpoint method using Springs

+3 votes

I am using Springs 3. I have a method in an Endpoint class which handles the web service request. The method is annotated with @Action to make it asynchronous. The SOAP request header contains some information (like UUID, Reply Address, etc). I need to be able to access these header information from inside this method.

The Spring WS MessageContext as well as the Apache axis MessageContext seems to be empty, so I am not able to use it inside the method to derive the SOAP header.

posted Sep 19, 2013 by Ranjeeth K Rao

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+2 votes
Best answer

With @Action and Reply Address - i am assuming that it is WS-Addressing parameters. Not sure how you got the MessageContext to be null. I had once was in a similar situation earlier (but was not able to access the MessageContext from the Endpoint method).

I followed the steps mentioned in this website

Once MessageContext is retrieved (hopefully not null), the said parameters can be easily accessed by something like this

SoapMessage sm = (SoapMessage) mc.getRequest();
Iterator<SoapHeaderElement> iter = sm.getEnvelope().getHeader().examineAllHeaderElements();
        while (iter.hasNext()) {
            SoapHeaderElement she =;
  "\n"+she.getName().getLocalPart()+ " - "+she.getText());   
answer Sep 20, 2013 by anonymous
Thanks for the reply. I dropped by to post the same link and it was just there. :)
Thanks anyways!!