• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stub generated using Axis2 Webservice creates new connection for redirect URL

 
Mohsin Jafri
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends,

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:-

1. 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.
2. The next API call is required to be made at this redirect location. IN THE SAME TCP CONNECTION, for getting a proper response.
3. 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)"
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.

I have tried everything mentioned as a solution in web and nothing is working out. For e.g --

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);

Similarly, I have tried many other options too. But its not helpful at all.

Please help me find a solution. I need it very urgently.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic