ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Sliding into WebDAV
Subject:   WebDAV & NTLM:Hi i am facing a problem to connect to MSSharePoint 2003 portal server
Date:   2008-07-25 05:47:52
From:   httpclient.HttpException
Response to: WebDAV & NTLM:Hi i am facing a problem to connect to MSSharePoint 2003 portal server



Hi, Im having the same problem with the same httpException. Im trying to connect to a IIS server and I use the below code. Please tell me how you solved the problem



public static boolean fileUpload(String localfilepath,String url,String destfolder,String destfile)
{
boolean success=false;
try
{

File file = new File(localfilepath);
BufferedImage image = ImageIO.read(file);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ImageIO.write(image, "bmp", bos);
byte byteArr[] = bos.toByteArray();
bos.close();

HttpURL hrl =new HttpURL(url);
//hrl.setUserinfo("uname","password");
WebdavResource wdr =new WebdavResource(hrl);
success = wdr.putMethod("/"+destfolder+"/"+destfile, byteArr);
wdr.close();
System.out.println(success);


}catch(Exception ex)
{
ex.printStackTrace();
}


return success;

}


My IIS server is running in windows server 2003 platform.and i will get the exception below.



org.apache.commons.httpclient.HttpException
at org.apache.webdav.lib.WebdavResource.propfindMethod(WebdavResource.java:3467)
at org.apache.webdav.lib.WebdavResource.propfindMethod(WebdavResource.java:3423)
at org.apache.webdav.lib.WebdavResource.setNamedProp(WebdavResource.java:967)
at org.apache.webdav.lib.WebdavResource.setBasicProperties(WebdavResource.java:912)
at org.apache.webdav.lib.WebdavResource.setProperties(WebdavResource.java:1894)
at org.apache.webdav.lib.WebdavResource.setHttpURL(WebdavResource.java:1301)
at org.apache.webdav.lib.WebdavResource.setHttpURL(WebdavResource.java:1320)
at org.apache.webdav.lib.WebdavResource.setHttpURL(WebdavResource.java:1408)
at org.apache.webdav.lib.WebdavResource.<init>(WebdavResource.java:290)


------------------------------------------------


But the same above code work successfully by connecting the IIS server which is running in WindowsXP platform. Please Suggest the solution and help me. Thanks a lot.


By Saravanan.K