title: How to add security header parameters to SOAP Request in java
body: <p>Default header is empty and I have to add security header to Soap request as below:</p>
  
  <pre><code>&lt;soapenv:Envelope xmlns:end="http://endpoint.soap.esb.steg.com.tn/" 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-633D8322A7C327A0D5153295320052614"&gt;
              &lt;wsse:Username&gt;website&lt;/wsse:Username&gt;
              &lt;wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"&gt;7MyXmdbbBuyiHQwGCAY2+NxYRH8=&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;sdc+Kcgj/aghCxpUCACCxQ==&lt;/wsse:Nonce&gt;
              &lt;wsu:Created&gt;2018-07-30T12:20:00.526Z&lt;/wsu:Created&gt;
          &lt;/wsse:UsernameToken&gt;&lt;/wsse:Security&gt;    
      &lt;/soapenv:Header&gt;
      &lt;soapenv:Body&gt;
          &lt;end:consultInfoAboBT&gt;
              &lt;reference&gt;00095013&lt;/reference&gt;
          &lt;/end:consultInfoAboBT&gt;
      &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;    
  </code></pre>
  
  <p>This is my code </p>
  
  <pre><code>request = "&lt;soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:end='http://endpoint.soap.esb.steg.com.tn/'&gt;"+ "&lt;soapenv:Header/&gt;"+"&lt;soapenv:Body&gt;" + "&lt;end:consultInfoAboBT&gt;"
  + "&lt;reference&gt;"+reference+"&lt;/reference&gt;" + "&lt;/end:consultInfoAboBT&gt;" + "&lt;/soapenv:Body&gt;"+ "&lt;/soapenv:Envelope&gt;";
  StringEntity param = new StringEntity(request);     
  response = json.makeHttpRequestSteg(URLSWSTEG1, "POST", param, message);
  Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(response)));
  </code></pre>