Hello, everyone,

I'm having trouble sending files using the Slide WebDAV Client library
from the binary 2.1 distribution. The code executes normally, and the
putMethod() call returns true, but the file does not appear in the
WebDAV repository. I'm able to send the same file using the same login
credentials using a folder mapped in My Nework Places in Windows 2000.
The server is the WebDAV gateway to Oracle 10g's XML DB Repository. My
code is able to get a directory listing of arbitrary folders on the
server, so it's connecting fine. My code is listed below... can
anybody tell me what I might be doing wrong? Is there some sort of
flush() method I need to use or something? I see there's transaction
defining methods available, but the example code in the Wiki doesn't
use them, so I'm assuming they're not needed for cases where
transactions aren't required by whatever process that is using the
library.

Thanks for whatever help or guidance you might be able to provide,

Michael Della Bitta

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

public static void main(String[] args) {

   WebdavResource webdavResource = null;

   try {
       HttpURL httpUrl = new HttpURL("servername", 8080, "/");
       httpUrl.setUserinfo("username", "password");
       webdavResource = new WebdavResource(httpUrl, args[0]);
       String[] list = webdavResource.list();
       System.out.println("Directory Listing for " + args[0]);
       for (int i = 0; i < list.length; ++i) {
           System.out.println(list[i]);
       }

       if (args.length == 2) {
           System.out
                   .println("Sending file " + args[1] + " to " + args[0]);
           File fileToSend = new File(args[1]);
           if (!fileToSend.exists())
               throw new Exception(args[1] + " does not exist");
           if (fileToSend.isDirectory())
               throw new Exception(args[1] + " is a directory");

           boolean result = webdavResource.putMethod(fileToSend);
           if (!result) {
               System.out.println("File send failed.");
           } else {
               System.out.println("File transfer successful.");
           }
       }

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

   } finally {
       if (webdavResource != null) {
           try {
               webdavResource.closeSession();
           } catch (Exception e) {
           }
       }
   }
}

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to