title: java Apache Cxf HTTP authentication
body: <p>I have <code>WSDL</code>. I need to make <code>HTTP</code> basic (preemptive) authentication.
  What to do?</p>
  
  <p>I tried : </p>
  
  <pre><code>Authenticator myAuth = new Authenticator() {
      @Override
      protected PasswordAuthentication getPasswordAuthentication() {
          return new PasswordAuthentication("user", "pass".toCharArray());
      }
  };
  Authenticator.setDefault(myAuth);
  </code></pre>
  
  <p>But it does not work: Caused by: </p>
  
  <blockquote>
    <p>java.io.IOException: Server returned HTTP response code: 401 for URL ..</p>
  </blockquote>
  
  <p>P.S. I use Apache CXF 2.6.2 and JBoss 5.0.1</p>