You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Rajat Bhushan <ra...@oracle.com> on 2008/04/15 16:48:26 UTC
Problem retrieving cookie information
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
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org