You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by Michael Della Bitta <md...@gmail.com> on 2006/06/16 19:47:51 UTC

problems sending files with webdav client lib

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: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: Re: Re: problems sending files with webdav client lib

Posted by Raj Garikapati <ra...@yahoo.com>.
Hi,

We have Oracle IFS (CMSDK) 9.0.4. Getting Service Unavailable (503) error
message when trying to use putMethod(path, InputStream). It worked well with
putMethod(path,File)

Code Snippet:
File f = new File("c:/hello.txt");
InputStream inputStream = new FileInputStream(f);
webdavResource.putMethod(serverPath, inputStream); 

Any help is appreciated.

Thank you,
Raj.



Michael Della Bitta wrote:
> 
> Looking through the Oracle forums, it seems like I'm not the only one
> running into this issue. Following the example provided in the last
> post of this thread ended up doing it for me:
> http://forums.oracle.com/forums/thread.jspa?messageID=1223864&#1223864
> 
> Thanks for your time,
> 
> Michael
> 
> On 6/19/06, Michael Della Bitta <md...@gmail.com> wrote:
>> Marco,
>>
>> Sadly, that didn't change things for me. I'm still experiencing
>> putMethod() calls returning true and then the file doesn't appear in
>> the WebDAV repository. I'd actually be pretty surprised that supplying
>> a FileInputStream would work differently than supplying a File, but
>> I'm willing to try anything... Thanks for your suggestion.
>>
>> Is there any sort of logging or something like that I can configure?
>> Or should I resort to capturing packets?
>>
>> Michael
>>
>> On 6/19/06, Marco Ferretti <ma...@gmail.com> wrote:
>> > Hi,
>> >
>> > what I do ( and it works for me ) is to use the putMethod that takes a
>> > String and an InputStream as parameters .
>> > The String is the path where to store the file ... so what I'd do is
>> >
>> > result = webdavResource.putMethod(path, (InputStream) inputStream);
>> >
>> > where
>> >
>> > FileInputStream inputStream = new FileInputStream(toSend) ;
>> >
>> >
>> >
>> >
>> > hope it helps.
>> >
>> >
>> > Marco
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
>> > For additional commands, e-mail: slide-user-help@jakarta.apache.org
>> >
>> >
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/problems-sending-files-with-webdav-client-lib-tf1799748.html#a5934040
Sent from the Jakarta Slide - User forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: Re: Re: problems sending files with webdav client lib

Posted by Michael Della Bitta <md...@gmail.com>.
Looking through the Oracle forums, it seems like I'm not the only one
running into this issue. Following the example provided in the last
post of this thread ended up doing it for me:
http://forums.oracle.com/forums/thread.jspa?messageID=1223864&#1223864

Thanks for your time,

Michael

On 6/19/06, Michael Della Bitta <md...@gmail.com> wrote:
> Marco,
>
> Sadly, that didn't change things for me. I'm still experiencing
> putMethod() calls returning true and then the file doesn't appear in
> the WebDAV repository. I'd actually be pretty surprised that supplying
> a FileInputStream would work differently than supplying a File, but
> I'm willing to try anything... Thanks for your suggestion.
>
> Is there any sort of logging or something like that I can configure?
> Or should I resort to capturing packets?
>
> Michael
>
> On 6/19/06, Marco Ferretti <ma...@gmail.com> wrote:
> > Hi,
> >
> > what I do ( and it works for me ) is to use the putMethod that takes a
> > String and an InputStream as parameters .
> > The String is the path where to store the file ... so what I'd do is
> >
> > result = webdavResource.putMethod(path, (InputStream) inputStream);
> >
> > where
> >
> > FileInputStream inputStream = new FileInputStream(toSend) ;
> >
> >
> >
> >
> > hope it helps.
> >
> >
> > Marco
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: slide-user-help@jakarta.apache.org
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: Re: problems sending files with webdav client lib

Posted by Michael Della Bitta <md...@gmail.com>.
Marco,

Sadly, that didn't change things for me. I'm still experiencing
putMethod() calls returning true and then the file doesn't appear in
the WebDAV repository. I'd actually be pretty surprised that supplying
a FileInputStream would work differently than supplying a File, but
I'm willing to try anything... Thanks for your suggestion.

Is there any sort of logging or something like that I can configure?
Or should I resort to capturing packets?

Michael

On 6/19/06, Marco Ferretti <ma...@gmail.com> wrote:
> Hi,
>
> what I do ( and it works for me ) is to use the putMethod that takes a
> String and an InputStream as parameters .
> The String is the path where to store the file ... so what I'd do is
>
> result = webdavResource.putMethod(path, (InputStream) inputStream);
>
> where
>
> FileInputStream inputStream = new FileInputStream(toSend) ;
>
>
>
>
> hope it helps.
>
>
> Marco
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: problems sending files with webdav client lib

Posted by Marco Ferretti <ma...@gmail.com>.
Hi,

what I do ( and it works for me ) is to use the putMethod that takes a
String and an InputStream as parameters .
The String is the path where to store the file ... so what I'd do is

result = webdavResource.putMethod(path, (InputStream) inputStream);

where

FileInputStream inputStream = new FileInputStream(toSend) ;




hope it helps.


Marco

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org