title: setting header info in java web service client
body: <p>I hope someone can help me. I have been asked to create a client to call a web service, but the developers of the web service are less than helpful and have provided scant information. </p>
  
  <p>I have created the service client in NetBeans and I have added a handler (from examples I have seen) in order to set username and password for Basic Authentication. However, when I run the project I am told that authentication failed, so either I am sending the wrong information or I need to do some more. What I really don't understand is this: the developers of the web service say that the header should look like the following, so could anyone tell me how I achieve that, or is it all done for me? </p>
  
  <p>POST https:// …</p>
  
  <p>Accept-Encoding: gzip,deflate </p>
  
  <p>Content-Type: text/xml;charset=UTF-8 </p>
  
  <p>SOAPAction: ”” </p>
  
  <p>Authorization: Basic MjAwKKAwNjAwMTpQcjBlZSRza!:uYWw= </p>
  
  <p>Content-Length: 848 </p>
  
  <p>Host: … </p>
  
  <p>Connection: Keep-Alive </p>
  
  <p>User-Agent: Apache-HttpClient/4.1.1 </p>
  
  <p>thanks in advance,</p>