title: How to obtain username and password from SoapUI Auth Tab (HTTP Headers) in a Spring-WS Interceptor?
body: <p>I'm working with spring-ws, I need to perform simple username and password validation on my webservice calls. For that, I need to obtain the default soap header attributes for username and password. I have no idea how to do that with spring-ws and I've spent a lot of time trying to figure it out.</p>
  
  <p>I'm using SoapUI and sending the username and password by setting them in the "Aut" tab.</p>
  
  <p>My interceptor intercepts my calls, but I've debugged the messageContext and I have no idea where those fields are.</p>
  
  <p>This is my code, it never enters to the code in the while, so the iterator is return false in the hasNext.</p>
  
  <pre><code> @Override
   public boolean handleRequest(MessageContext messageContext, Object endpoint) throws Exception {
     logger.info("Intercepting call");
     SoapMessage soapMessage = (SoapMessage) messageContext.getRequest();
     SoapHeader soapHeader = soapMessage.getSoapHeader();
  
     Iterator&lt;SoapHeaderElement&gt; it = soapHeader.examineAllHeaderElements();
     while(it.hasNext()) {
      SoapHeaderElement element = it.next();
      QName qname = element.getName();
      logger.info("QName: " + qname.getLocalPart());
      logger.info("Value? " + soapHeader.getAttributeValue(qname));
    }
  
  return true;
  }
  </code></pre>
  
  <p>If you would kindly point me towards any documentation on the subject, or better yet, some examples, it will be a great help. </p>
  
  <p>Thanks a lot.</p>