WEBDAV throught SSL
Hi,ALL
I write a client source.
I want to use webDAV to access Exchange public folder
Customer public folder security setting is SSL enable.
So I my httpClient also should be SSL Enable.
I have my source:
String personalURL = "http://172.16.0.20:8988/public/";
XMLResponseMethodBase method = null;
try{
// SSL
// jdk 1.4
try{
String secProviderName = "com.sun.crypto.provider.SunJCE";
java.security.Provider secProvider =
(java.security.Provider)Class.forName(secProviderName).newInstance();
Security.addProvider(secProvider);
}catch(Exception ex){
System.out.println(ex.toString());
}
// if want to going throught https: it is supposed to add the following Provider
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
NTCredentials creds = new NTCredentials("8700@mydomain.com", "test", "172.16.0.20:8988", "");
setState(new WebdavState());
HostConfiguration hostConfig = getHostConfiguration();
HttpState clientState = getState();
clientState.setCredentials(null, "172.16.0.20:8988",creds);
clientState.setAuthenticationPreemptive(true);
setConnectionTimeout(120000);
method = new SearchMethod(URIUtil.encodePathQuery(personalURL));
method.setDebug(3);
method.setRequestHeader("Translate", "f");
method.setRequestHeader("Content-Type", "text/xml");
method.setRequestHeader("Depth", "1");
method.setRequestHeader("Content-Length", "" + query.length());
method.setRequestBody(query);
method.setFollowRedirects(false);
int result = executeMethod(method);
Document m_doc = method.getResponseDocument();
method.releaseConnection();
}catch(Exception ex)
{
System.out.println(ex.toString());
}
The problem is:
when I set String personalURL = "http://172.16.0.20:8988/public/";
it gives me an exception:
Jun 9, 2006 11:43:06 AM org.apache.commons.httpclient.HttpMethodBase readResponseBody
WARNING: Response content length is not known
Jun 9, 2006 11:43:06 AM org.apache.commons.httpclient.HttpMethodBase processRedirectResponse
INFO: Redirect requested but followRedirects is disabled
if I set String personalURL = "https://172.16.0.20:8988/public/";
I get the following exception:
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
any suggestion would be great accepted

