title: Spring ClientInterceptor shows empty SOAP header in response
body: <p>I have a SOAP service which I need to talk to. The first SOAP request receives a response with a <em>sessionID</em> element in the SOAP header which I need to send in the final release command.</p>
  
  <p>To grab this sessionID value I plan on using a <em>ClientInterceptor</em>. In my implementation of <em>WebServiceGatewaySupport</em> I register my interceptor:</p>
  
  <pre><code>this.setInterceptors(new ClientInterceptor[] { new MyWebServiceClientInterceptor() });
  </code></pre>
  
  <p>My Interceptor:</p>
  
  <pre><code>public class MyWebServiceClientInterceptor implements ClientInterceptor {
  
      public final QName SessionID_QNAME = new QName("http://xml.example.com/ws/session", "sessionID");
  
      public boolean handleFault(MessageContext context) throws WebServiceClientException {
          logger.info("Handle Fault");
          return true;
      }       
  
      public boolean handleResponse(MessageContext context) throws WebServiceClientException {
          logger.info("Handle Response");
          SoapMessage soapMessage = (SoapMessage) context.getRequest();
          SoapHeader soapHeader = soapMessage.getSoapHeader();
  
          logger.info("Response Header: " + soapHeader.getName());
          Iterator&lt;SoapHeaderElement&gt; qn = soapHeader.examineAllHeaderElements();
          while (qn.hasNext()) {
              SoapElement elem = qn.next();
              logger.info(elem.toString());
          }
          Iterator&lt;QName&gt; an = soapHeader.getAllAttributes();
          while (an.hasNext()) {
              QName elem = an.next();
              logger.info(elem.toString());
          }
          return true;
      }
  
      public boolean handleRequest(MessageContext context) throws WebServiceClientException {
          logger.info("Handle Request");
          return true;
      }
  }
  </code></pre>
  
  <p>However I keep getting back an empty SOAP header. I'm running Wireshark and can clearly see the <em>sessionID</em> token in the returned SOAP packet so at a lost as to what's going on. Any ideas?</p>