Hi guys.
I am facing some problems at client side using AXIS2 to access
multiple cookies returned to the java client by a .NET web service. I
had posted this problem earlier but it got lost in the mailing list. Can
somebody please help me with some other method or documentation to
access multiple cookies with same tcp header key "Set-Cookie" from the
web service response.
Thanks in advance,
Rajat Bhushan
-------- Original Message --------
Subject: Problem retrieving cookie information
Date: Tue, 15 Apr 2008 20:18:26 +0530
From: Rajat Bhushan <[EMAIL PROTECTED]>
To: [email protected]
Hi .
I am writing a Java client to call a .NET web service which is used
for authentication purposes. This authentication service return me 2
cookies. One with attribute name : ".ASPXAUTH...."
and other one with attribute name : "PWA656....".
I was having problem accessing the cookie. So I used the following code
snippet :
OMElement loginRequest = loginRequest(username,password);
Options options = new Options();
options.setAction(NAMESPACELogin+"Login");
options.setTimeOutInMilliSeconds(TIMEOUT);
options.setTo(targetEPR1);
client.setOptions(options);
OMElement result = client.sendReceive(loginRequest);
if(((CommonsTransportHeaders)((MessageContext)client.getServiceContext().getLastOperationContext().getMessageContexts().get("In")).getProperty("TRANSPORT_HEADERS")).get("Set-Cookie")
!= null) {
this.setCookie(((CommonsTransportHeaders)((MessageContext)client.getServiceContext().getLastOperationContext().getMessageContexts().get("In")).getProperty("TRANSPORT_HEADERS")).get("Set-Cookie").toString());
}
Now my problem is that a "getProperty" operation on
CommonsTransportHeaders object actually accesses a HeaderMap which is a
HashMap. When this HashMap is initialized, the cookie value is
overwritten as they both have same key "Set-Cookie". So I am able to
access only one of them. The one I need is overwritten and is not
accessible.
Can someone please suggest a method by which I can access both the
cookies so that I may use the one I need or point me to some other post
where this problem is addressed.
Thanks,
Rajat Bhushan