title: Axis2 multiple connection authentication issue
body: <p>I have two servlets that access two corresponding Axis2 web services on the same host. One of the servlets is read-only, while the other writes to a database. </p>
  
  <p>Each of the Axis2 web services uses BASIC authentication. The read-only web service uses a system account, while the write web service uses the user's credentials (which are submitted as part of a web form).</p>
  
  <p>The problem I'm running into is that the servlet called <em>second</em> always fails authentication to its web service. For example, I can query the read-only service through it's servlet all I want, but I get a "401: Authorization Required" when I try to use the write service. If I call the write service first, I get the same error when I try to use the read-only service.</p>
  
  <p>Here is how I am setting the credentials for the connections in the servlets:</p>
  
  <pre class="lang-java prettyprint-override"><code>Stub service = new Stub(serviceUrl);
  HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
  auth.setUsername(username);
  auth.setPassword(password);
  auth.setPreemptiveAuthentication(true);
  
  service._getServiceClient().getOptions().setProperty(HTTPConstants.AUTHENTICATE, auth);
  </code></pre>
  
  <p>The servlet that accesses the read-only service has this code in it's constructor. The servlet that accesses the write service has this code in it's doGet/doPost method.</p>
  
  <p>It seems that the credentials for the first service called are getting cached somewhere, but I can't find where that could be. I saw a possible solution <a href="http://axis.apache.org/axis2/java/core/docs/http-transport.html#setting_cached_httpclient_object" rel="nofollow">here</a>, but I can't find where <code>WSClientConstants.CACHED_HTTP_STATE</code> is defined. <a href="https://issues.apache.org/jira/browse/AXIS2-4288" rel="nofollow">The comments in this JIRA issue</a> seems to imply that it's part of <code>org.apache.axis2.transport.http.HTTPConstants</code> but it's not there.</p>
  
  <p>Specifics:</p>
  
  <ul>
  <li>Axis version: 1.5.1</li>
  <li>Tomcat Version: 6.0.26</li>
  <li>Java version: 1.6.0_23</li>
  </ul>