Hi Community,
I was finally able to accomplish the successful transfer of audio
file to the web server over HTTP. I used PostMethod in conjunction with
MultiPartPostMethod to send the data. And it worked fine. But I can only
do this if I am using a standalone application on the client side. I
want to achieve the same through an applet. When I use my jar file
(containing the relevant class files that use HttpClient/PostMethod) in
the <applet> tag, the applet does not get initialized. If I use a
similar jar file without HttpClient code, the applet works fine. Can
someone tell me what can be the issue?
Thanks,
Niti
-----Original Message-----
From: Niti Bhatt (PL/EUS) [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 01, 2007 11:37 AM
To: HttpClient User Discussion
Subject: RE: Problem using PostMethod
Hi Roland,
I made a local copy of a simple text file and tried to store in
locally in memory and it worked fine. Then I tried using and audio file
and it also got stored in memory locally. But when I tried to send it to
a webserver using URL, URLConnection, and OutputStream, it didn't read
on the server.
I appreciate your help..
Niti
-----Original Message-----
From: Roland Weber [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 01, 2007 10:04 AM
To: HttpClient User Discussion
Subject: Re: Problem using PostMethod
Hello Niti,
> Thanks for your reply. Yes, I also tried sending the plain file
> without the AudioStream. Still it was not received at the server. I am
> using the setRequestEntity method since setRequestBody is deprecated.
> Do you think that might be a problem?
No, that is the way you're supposed to do it. Could it be that there is
a problem with the file you are sending? For example that another
process has a lock on the file and it can't be opened because of that?
Try making a copy manually and send the copy.
> After making several attempts, I finally switched to something without
> using HttpClient, i.e. I used URL, URLConnection and OutputStream to
> write the audio data to the stream. I see that it gets received at the
> server meaning it shows the content length correctly. But when I try
> to perform a read on the stream, it always returns -1.
The content length is sent in the header, and it seems the file data
isn't sent with HttpURLConnection either. I suspect the problem is on
the client side when reading the file. Have you tried reading it into
memory without sending it?
Consider enabling the wire log for the headers and send us the output:
http://jakarta.apache.org/commons/httpclient/logging.html
hope that helps,
Roland
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]