• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Setting cookies on Axis2 client request for Exchange server

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

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.setAuthSchemes(authScheme);
authenticator.setUsername(userName);
// authenticator.setPassword(password);
authenticator.setHost(exchangeHost);
authenticator.setDomain(exchangeDomain);
authenticator.setPort(Integer.parseInt(urlAndPort[1]));

options.setProperty(HTTPConstants.AUTHENTICATE, authenticator);

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

m_EWSservice._getServiceClient().setOptions(options);

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic