After more investigation found that we can get rid of this by setting unique
cookie names for each of the servers. If we set unique cookie names, axis
sends all those cookies to each server along with every API call. This
solution does not look that clean and if there are huge number of
servers(lets say 500) to which our client is connecting to at any given
point in time then we will end up having(and sending) 500 cookies along with
each API call(if not restricted).

Later with more investigation found that Axis2 provides us a feature to
avoid overwriting of cookies with same names when connected to multiple
servers by setting the custom cookie id. By going through Axis source
code(AbstractHTTPSender.java), I think Axis tries to extract the cookie with
name Constants.CUSTOM_COOKIE_ID(set using setProperty) from the response and
attaches it to ServiceContext so that the next request to that server will
be attached with cookie extracted in previous response.

I tried doing this but was not successful in getting the expected results,
still the cookies were getting overwritten. Hope and wish that I am doing
some thing wrong here, below is how I set Constants.CUSTOM_COOKIE_ID

         ServiceClient serviceClient = stub._getServiceClient()
         Options options = serviceClient.getOptions();
         options.setManageSession(true);
         options.setTimeOutInMilliSeconds(timeoutInMilliseconds);
         options.setProperty(Constants.CUSTOM_COOKIE_ID, "XXXSESSIONID");
         serviceClient.setOptions(options);

After this I expect Axis to handle the cookie overwriting but does not seem
like that. I feel there is something wrong the way I am setting the
property.

Guys, please let me know your views on this. I am completely stuck with this
problem.

Note: we are using scope=application and that cannot be changed.



--
View this message in context: 
http://axis.8716.n7.nabble.com/Cookie-getting-overwritten-when-client-connects-to-multiple-servers-tp111918p111999.html
Sent from the Axis Java - Dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@axis.apache.org
For additional commands, e-mail: java-dev-h...@axis.apache.org

Reply via email to