title: SOAP-WS security header authentication
body: <p>I have developed a webservices using spring+ XSD+ Payload. I have a requirement of authenticating the request header with username and password coming in SOAP request header which i achieved with SOAPUI</p>
  
  <p>I m able to generate the below header in the request</p>
  
  <pre><code>   &lt;soapenv:Envelope xmlns:jaxb="http://jaxb.miws.sg.com/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"&gt;
     &lt;soapenv:Header&gt;
     &lt;wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis- 200401-wss-wssecurity-secext-1.0.xsd" 
     xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"&gt;
     &lt;wsse:UsernameToken wsu:Id="UsernameToken-C3092BFBAE5B212E93144378035575013"&gt;
     &lt;wsse:Username&gt;User&lt;/wsse:Username&gt;
     &lt;wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"&gt;test&lt;/wsse:Password&gt;
     &lt;wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"&gt;CT1Fyo/g2WMaadE52bsnkg==           &lt;/wsse:Nonce&gt;
     &lt;wsu:Created&gt;2015-10-02T10:05:55.750Z&lt;/wsu:Created&gt;
     &lt;/wsse:UsernameToken&gt;
     &lt;/wsse:Security&gt;
     &lt;/soapenv:Header&gt;
  </code></pre>
  
  <p>Now i want to validate the header elements for userName and Password. </p>
  
  <p>Ex: </p>
  
  <p>Case 1:
     userName=User and Password=test //Authentication passed and give response Success</p>
  
  <p>Case 2:
     userName=User1 and Password=test1 //Authentication failed and give response Failure</p>
  
  <p>Please help me to provide the suitable samples to achieve same.</p>