I believe that I've finally cracked this though I am highly suspicious of its
complexity -- you'd think that it would be trivial retrieving a cookie, and
maybe it is but how you do it is not at all obvious.

Here's what I did:

MyServiceLocator locator = new MyServiceLocator();
locator.setMaintainSession(true);
MyService service = locator.getMyService();

service.login("fred", "fredpass"); // server sends me some cookies here

// I want to get those cookies here
MessageContext ctx = locator.getCall().getMessageContext();
Message rsp = ctx.getResponseMessage();
MimeHeaders mhd = rsp.getMimeHeaders();
String [] cookies = mhd.getHeader("set-cookie");
if (cookies != null)
{
 // parse value of JSESSIONID from cookies[0]
}

service.dosomethingelse();
service.logout();



jarmod wrote:
> 
> I've read about 14 million internet posts (OK, it was just 13 million) on
> the topic of how an Axis (1.4 in this case) client might retrieve cookies
> and, quite surprisingly, I have yet to find a solution that actually
> works.
> 
> My Axis client uses the highest-level abstraction so looks something like
> this:
> 
> MyServiceLocator locator = new MyServiceLocator();
> locator.setMaintainSession(true);
> MyService service = locator.getMyService();
> 
> service.login("fred", "fredpass"); // server sends me some cookies here
> // I want to get those cookies here
> service.dosomethingelse();
> service.logout();
> 
> The code works fine and uses JSESSIONID cookie-based session management
> automatically.  However, I want more thanthat -- I want to be able to
> retrieve the cookies in the HTTP response associated with the login.
> 
> I've tried to retrieve the cookies using
> stub._getProperty(HTTPConstants.HEADER_COOKIE) but that returns NULL. 
> I've also enumerated all properties of the stub *after* the login call and
> there are none.  Can you even do what I want at this interface level?
> 
> Appreciate any help.
> 

-- 
View this message in context: 
http://www.nabble.com/Axis-1.4-client-get-cookies-tf3409630.html#a9519062
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to