title: Stub generated using Axis2 Webservice forming new connection for redirect URL...Need same TCP connection...!
body: <p>I am badly stuck with a SOAP based integration using Axis2 framework for generation of client stubs from the Server WSDL. The scenario is as follows :</p>
  
  <ol>
  <li>There is always a login API call first, which gives a Success response in SOAP body and  Temporary Redirect in HTTP header. Also provides a URL which contains the session ID in the Location field of HTTP Header.</li>
  <li>The next API call is required to be made at this redirect location. IN THE SAME TCP CONNECTION, for getting a proper response.
  <ol>
  <li>Now, the problem is, as a part of Webservice implementation using Axis2 generated stubs, I need to reload this redirect URL and re-instantiate it as --- "stub=new Stub(newurl)"</li>
  <li>As soon as this is done, it creates a new TCP connection and so, the next request gives the response as "session ID invalid" because it goes out-of-sync with login API.</li>
  </ol></li>
  </ol>
  
  <p>I have tried everything mentioned as a solution in this forum and nothing is working out.
  For e.g -- </p>
  
  <hr>
  
  <pre><code>MultiThreadedHttpConnectionManager httpConnectionManager = new MultiThreadedHttpConnectionManager();
              HttpClient httpClient = new HttpClient(httpConnectionManager);
  
  
              ServiceClient serviceClient = stub._getServiceClient();
              Options opts = stub._getServiceClient().getOptions();
  
              opts.setTo(new EndpointReference(prop.getProperty("target_end_point_url")));
              opts.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Constants.VALUE_TRUE);
              opts.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);
  
              serviceClient.setOptions(opts);
  
              stub._setServiceClient(serviceClient);
  </code></pre>
  
  <hr>
  
  <p>Similarly, I have tried many other options too. But it's not helpful at all.</p>