title: How to set headers in Soap Request Java
body: <p>I am facing issue in forming a SOAP request.</p>
  
  <p>In that request i am supposed to add username , password and some other info in header part not the part of payload.</p>
  
  <p>Below the Entry in wsdl</p>
  
  <pre><code>&lt;wsdl:message name="InputUploadCustomerDocument_Headers"&gt;
  &lt;wsdl:part name="DocumentType" element="tns:DocumentType"/&gt;
  &lt;wsdl:part name="FileName" element="tns:FileName"/&gt;
  &lt;wsdl:part name="Password" element="tns:Password"/&gt;
  &lt;wsdl:part name="PinNo" element="tns:PinNo"/&gt;
  &lt;wsdl:part name="UserName" element="tns:UserName"/&gt;
  &lt;/wsdl:message&gt;
  &lt;wsdl:message name="ReturnUploadCustomerDocument"&gt;
  &lt;wsdl:part name="parameters" element="tns:ReturnUploadCustomerDocument"/&gt;
  &lt;/wsdl:message&gt;
  
  
  &lt;wsdl:operation name="UploadCustomerDocument"&gt;
  &lt;soap:operation soapAction="http://tempuri.org/ISend/UploadCustomerDocument" style="document"/&gt;
  &lt;wsdl:input name="InputUploadCustomerDocument"&gt;
  &lt;soap:header message="tns:InputUploadCustomerDocument_Headers" part="DocumentType" use="literal"/&gt;
  &lt;soap:header message="tns:InputUploadCustomerDocument_Headers" part="FileName" use="literal"/&gt;
  &lt;soap:header message="tns:InputUploadCustomerDocument_Headers" part="Password" use="literal"/&gt;
  &lt;soap:header message="tns:InputUploadCustomerDocument_Headers" part="PinNo" use="literal"/&gt;
  &lt;soap:header message="tns:InputUploadCustomerDocument_Headers" part="UserName" use="literal"/&gt;
  &lt;soap:body use="literal"/&gt;
  &lt;/wsdl:input&gt;
  &lt;wsdl:output name="ReturnUploadCustomerDocument"&gt;
  &lt;soap:body use="literal"/&gt;
  &lt;/wsdl:output&gt;
  &lt;/wsdl:operation&gt;
  </code></pre>
  
  <p>And the InputUploadCustomerDocument Java File Below, the file don't have username, password and other fields, and i need to set these parameters before making reuqest</p>
  
  <pre><code>@XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = "", propOrder = {
  "fileData"
  })
  @XmlRootElement(name = "InputUploadCustomerDocument")
  public class InputUploadCustomerDocument {
  
  @XmlElement(name = "FileData", required = true)
  protected byte[] fileData;
  
  /**
   * Gets the value of the fileData property.
   * 
   * @return
   *     possible object is
   *     byte[]
   */
  public byte[] getFileData() {
      return fileData;
  }
  
  /**
   * Sets the value of the fileData property.
   * 
   * @param value
   *     allowed object is
   *     byte[]
   */
  public void setFileData(byte[] value) {
      this.fileData = value;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Here is the function i need to call</p>
  
  <pre><code>@WebMethod(operationName = "UploadCustomerDocument", action = "http://tempuri.org/ISend/UploadCustomerDocument")
  @WebResult(name = "ReturnUploadCustomerDocument", targetNamespace = "http://tempuri.org/", partName = "parameters")
  @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
  public ReturnUploadCustomerDocument uploadCustomerDocument(
      @WebParam(name = "InputUploadCustomerDocument", targetNamespace = "http://tempuri.org/", partName = "parameters")
      InputUploadCustomerDocument parameters);
  </code></pre>
  
  <p>Can someone help how i can set these headers?</p>