• Post Reply Bookmark Topic Watch Topic
  • New Topic

Setting cookies on Axis2 client request for Exchange server  RSS feed

nDilip Gupta
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have generated classes using Axis2 1.4 tool for Exchange 2007 Web services. Now I am connecting Exchange server using Exchange server credentials which are working fine and able to get the results from Exchange server.

Now, I have to implement SSO for the same. In this case we are retrieving cookies from server (In my case IBM portal server) and pass these on Axis2 generated classes. What I found in research, we can set the cookies in two places.

First place at org.apache.axis2.context.ConfigurationContext configurationContext which used the code below,

String cookie = "LtpaToken="+cookieLtpaToken+"; JSESSIONID="+cookieJSessionID+"; PD-S-SESSION-ID="+cookiePDSessionID;
configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext();
configurationContext.setProperty("cookie", cookie);

Second place at org.apache.axis2.client.Options which used the code below,

Options options = m_EWSservice._getServiceClient().getOptions();
HttpTransportProperties.Authenticator authenticator = new HttpTransportProperties.Authenticator();
List authScheme = new ArrayList();
authScheme.add(exchangeAuth);// DIGEST, NTLM, BASIC
// authenticator.setPassword(password);

options.setProperty(HTTPConstants.AUTHENTICATE, authenticator);

// Managing the session using the service client
options.setProperty("cookie", cookie);


In the given code lines, we are not setting password as I have to achieve SSO.

Once we use this code and run our application, we are getting error. That is,

[5/5/11 18:12:36:422 IST] 0000003f SystemOut O EWS url ****:::::::::::::::https://cdc.testmail.testyash.com/EWS/exchange.asmx
[5/5/11 18:12:36:422 IST] 0000003f SystemOut O EWS port :::::::::::::::443
[5/5/11 18:12:48:969 IST] 0000003f HttpMethodDir W org.apache.commons.httpclient.HttpMethodDirector processWWWAuthChallenge Unable to respond to any of these challenges: {basic=Basic realm="cdc.testmail.testyash.com"}
[5/5/11 18:12:49:109 IST] 0000003f HTTPSender I org.apache.axis2.transport.http.HTTPSender sendViaPost Unable to sendViaPost to url[https://cdc.testmail.testyash.com/EWS/exchange.asmx]
org.apache.axis2.AxisFault: Transport error: 401 Error: Unauthorized
at org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:296)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:190)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:364).

Please suggest me if anyone is having some idea for the same.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!