title: How to add soap header when making a soap request using the java objects generated by wsdl
body: <p>I generated client java objects using JAX-WS RI. I am trying to make a SOAP request to a web service. Service requires authentication in the header which looks like below: </p>
  
  <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"&gt;
  &lt;soapenv:Header&gt;
  &lt;xsd:authHeader&gt;
  &lt;xsd:user&gt;username@gmail.com&lt;/xsd:user&gt;
  &lt;xsd:password&gt;password1&lt;/xsd:password&gt;
  &lt;/xsd:authHeader&gt;
  &lt;/soapenv:Header&gt;
  &lt;soapenv:Body&gt;
  &lt;ns:searchAssetsParam&gt;
  &lt;ns:includeSubfolders&gt;true&lt;/ns:includeSubfolders&gt;
  &lt;ns:resultsPage&gt;2&lt;/ns:resultsPage&gt;
  &lt;/ns:searchAssetsParam&gt;
  &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p>The generated java objects have methods for calling the service, creating the objects and constructing the header. But, I am having trouble setting the header while making the call. </p>
  
  <p>Here's the code that I am using:</p>
  
  <pre><code>IpsApiService service = new IpsApiService();
  IpsApiPortType port = service.getIpsApiSoapPort();
  SearchAssetsParam searchAssetsParam = buildSearchAssetsParam();
  SearchAssetsReturn response = port.searchAssets(searchAssetsParam);
  </code></pre>
  
  <p>buildSearchAssetsParam() constructs the request object. 
  I created the header object as follows:</p>
  
  <pre><code>AuthHeader header = new AuthHeader();
  header.setUser("username@gmail.com");
  header.setPassword("password1");
  </code></pre>
  
  <p>How do I set this AuthHeader to the service request?</p>
  
  <p>Thanks,
  Venu</p>