|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Upload file - multipartI am attempting to upload a file to a server, using HttpClient to talk
to the server application. The user I am logging in with is able to successfully upload a file through a browser. When I attempt the same request in my application code, the server returns a 500 error. I don't have access to the server, so I cannot look at the logs to see what causes the 500. In my application code. In my application, I get logged in, receive the proper cookies from the server, etc. My file upload request and the one sent through the browser are the same, or very similar, as far as I can tell. I searched the mail list archives for file upload and tried the suggestions that I found there to no avail. Here are the logs from both my application and the browser application, as it relates to the file upload post. Any help is much appreciated. Thanks, Danny |
|
|
RE: Upload file - multipartStrange, it would not let me post the message with the logs in the body.
Bounced back as exceeding spam threshold. Do I post them as attachments? -----Original Message----- From: Danny Gallagher [mailto:danny.gallagher@...] Sent: Friday, June 12, 2009 8:52 AM To: httpclient-users@... Subject: Upload file - multipart I am attempting to upload a file to a server, using HttpClient to talk to the server application. The user I am logging in with is able to successfully upload a file through a browser. When I attempt the same request in my application code, the server returns a 500 error. I don't have access to the server, so I cannot look at the logs to see what causes the 500. In my application code. In my application, I get logged in, receive the proper cookies from the server, etc. My file upload request and the one sent through the browser are the same, or very similar, as far as I can tell. I searched the mail list archives for file upload and tried the suggestions that I found there to no avail. Here are the logs from both my application and the browser application, as it relates to the file upload post. Any help is much appreciated. Thanks, Danny My Application: FINE: >> "POST /Example/retail/protected/uploadFile HTTP/1.1[\r][\n]" FINE: >> "POST / Example /retail/protected/uploadFile HTTP/1.1[\r][\n]" FINE: >> "POST / Example /retail/protected/uploadFile HTTP/1.1[\r][\n]" FINE: >> "Content-Type: multipart/form-data;boundary=---------------------------41184676334[\r][\n]" FINE: >> "Content-Type: multipart/form-data;boundary=---------------------------41184676334[\r][\n]" FINE: >> "Content-Type: multipart/form-data;boundary=---------------------------41184676334[\r][\n]" FINE: >> "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10[\r][\n]" FINE: >> "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10[\r][\n]" FINE: >> "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10[\r][\n]" FINE: >> "Host: xyz.com[\r][\n]" FINE: >> "Host: xyz.com[\r][\n]" FINE: >> "Host: xyz.com[\r][\n]" FINE: >> "Cookie: JSESSIONID=0000qYTNX8lJXhj3EWEXrm9sJeD:-1; LtpaToken=6m8+vJZcVeNR+pLQOElXHBLSB3v6FN/rjp0Qq+7w9crXzZVN1gAbtgylrmyetdLog1dESR5OqbY/eNvdaoqu9rfXefpzpH9Hr6L9chvMnDxMGhZUE56A8muiB6A5Ijhmof6Xix/UwIXmQc+01TRaW7sHB+ZWenTBEGl8Bne4G/GdqTMXoSKPb1r5DegoJi4Abw+vbPH4KrUtHiMpONOfRLjHaNFfjwfIlUCTE54ntoQ1yrddzFadRV+hFhphmTB3Mi5bLUQYv6Fp6kXRMRODxcIsBu6VYyFL2aA//GPhJMhAvk3DmJ6Wwg==[\r][\n]" FINE: >> "Cookie: JSESSIONID=0000qYTNX8lJXhj3EWEXrm9sJeD:-1; LtpaToken=6m8+vJZcVeNR+pLQOElXHBLSB3v6FN/rjp0Qq+7w9crXzZVN1gAbtgylrmyetdLog1dESR5OqbY/eNvdaoqu9rfXefpzpH9Hr6L9chvMnDxMGhZUE56A8muiB6A5Ijhmof6Xix/UwIXmQc+01TRaW7sHB+ZWenTBEGl8Bne4G/GdqTMXoSKPb1r5DegoJi4Abw+vbPH4KrUtHiMpONOfRLjHaNFfjwfIlUCTE54ntoQ1yrddzFadRV+hFhphmTB3Mi5bLUQYv6Fp6kXRMRODxcIsBu6VYyFL2aA//GPhJMhAvk3DmJ6Wwg==[\r][\n]" FINE: >> "Cookie: JSESSIONID=0000qYTNX8lJXhj3EWEXrm9sJeD:-1; LtpaToken=6m8+vJZcVeNR+pLQOElXHBLSB3v6FN/rjp0Qq+7w9crXzZVN1gAbtgylrmyetdLog1dESR5OqbY/eNvdaoqu9rfXefpzpH9Hr6L9chvMnDxMGhZUE56A8muiB6A5Ijhmof6Xix/UwIXmQc+01TRaW7sHB+ZWenTBEGl8Bne4G/GdqTMXoSKPb1r5DegoJi4Abw+vbPH4KrUtHiMpONOfRLjHaNFfjwfIlUCTE54ntoQ1yrddzFadRV+hFhphmTB3Mi5bLUQYv6Fp6kXRMRODxcIsBu6VYyFL2aA//GPhJMhAvk3DmJ6Wwg==[\r][\n]" FINE: >> "Content-Length: 1477[\r][\n]" FINE: >> "Content-Length: 1477[\r][\n]" FINE: >> "Content-Length: 1477[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "--" FINE: >> "--" FINE: >> "--" FINE: >> "konfrJlfCo5UFxj71JEBaN30gbcAgkFmDvN7c-73" FINE: >> "konfrJlfCo5UFxj71JEBaN30gbcAgkFmDvN7c-73" FINE: >> "konfrJlfCo5UFxj71JEBaN30gbcAgkFmDvN7c-73" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "Content-Disposition: form-data; name=" FINE: >> "Content-Disposition: form-data; name=" FINE: >> "Content-Disposition: form-data; name=" FINE: >> """ FINE: >> """ FINE: >> """ FINE: >> "fileType" FINE: >> "fileType" FINE: >> "fileType" FINE: >> """ FINE: >> """ FINE: >> """ FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "Content-Type: " FINE: >> "Content-Type: " FINE: >> "Content-Type: " FINE: >> "text/html" FINE: >> "text/html" FINE: >> "text/html" FINE: >> "; charset=" FINE: >> "; charset=" FINE: >> "; charset=" FINE: >> "ISO-8859-1" FINE: >> "ISO-8859-1" FINE: >> "ISO-8859-1" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "Issue" FINE: >> "Issue" FINE: >> "Issue" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "--" FINE: >> "--" FINE: >> "--" FINE: >> "konfrJlfCo5UFxj71JEBaN30gbcAgkFmDvN7c-73" FINE: >> "konfrJlfCo5UFxj71JEBaN30gbcAgkFmDvN7c-73" FINE: >> "konfrJlfCo5UFxj71JEBaN30gbcAgkFmDvN7c-73" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "Content-Disposition: form-data; name=" FINE: >> "Content-Disposition: form-data; name=" FINE: >> "Content-Disposition: form-data; name=" FINE: >> """ FINE: >> """ FINE: >> """ FINE: >> "theFile" FINE: >> "theFile" FINE: >> "theFile" FINE: >> """ FINE: >> """ FINE: >> """ FINE: >> "; filename=" FINE: >> "; filename=" FINE: >> "; filename=" FINE: >> """ FINE: >> """ FINE: >> """ FINE: >> "Test.txt" FINE: >> "Test.txt" FINE: >> "Test.txt" FINE: >> """ FINE: >> """ FINE: >> """ FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "Content-Type: " FINE: >> "Content-Type: " FINE: >> "Content-Type: " FINE: >> "text/plain" FINE: >> "text/plain" FINE: >> "text/plain" FINE: >> "; charset=" FINE: >> "; charset=" FINE: >> "; charset=" FINE: >> "ISO-8859-1" FINE: >> "ISO-8859-1" FINE: >> "ISO-8859-1" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "000000000002222220000123439200704110099384900CDELSYS Rule - TDELSYS Rule - Payee Name Field XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX1 [\r][\n]" FINE: >> "000000000002222220000123439200704110099384900CDELSYS Rule - TDELSYS Rule - Payee Name Field XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX1 [\r][\n]" FINE: >> "000000000002222220000123439200704110099384900CDELSYS Rule - TDELSYS Rule - Payee Name Field XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX1 [\r][\n]" FINE: >> "000000000002222220000123440200704119938491201 Text Field Maximum Amount Length [\r][\n]" FINE: >> "000000000002222220000123440200704119938491201 Text Field Maximum Amount Length [\r][\n]" FINE: >> "000000000002222220000123440200704119938491201 Text Field Maximum Amount Length [\r][\n]" FINE: >> "000000000002222220000123440200704110099384900 DELSYS Rule - TDELSYS Rule - Payee Name Field XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX1 [\r][\n]" FINE: >> "000000000002222220000123440200704110099384900 DELSYS Rule - TDELSYS Rule - Payee Name Field XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX1 [\r][\n]" FINE: >> "000000000002222220000123440200704110099384900 DELSYS Rule - TDELSYS Rule - Payee Name Field XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX1 [\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "--" FINE: >> "--" FINE: >> "--" FINE: >> "konfrJlfCo5UFxj71JEBaN30gbcAgkFmDvN7c-73" FINE: >> "konfrJlfCo5UFxj71JEBaN30gbcAgkFmDvN7c-73" FINE: >> "konfrJlfCo5UFxj71JEBaN30gbcAgkFmDvN7c-73" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "Content-Disposition: form-data; name=" FINE: >> "Content-Disposition: form-data; name=" FINE: >> "Content-Disposition: form-data; name=" FINE: >> """ FINE: >> """ FINE: >> """ FINE: >> "upload_file.x" FINE: >> "upload_file.x" FINE: >> "upload_file.x" FINE: >> """ FINE: >> """ FINE: >> """ FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "Content-Type: " FINE: >> "Content-Type: " FINE: >> "Content-Type: " FINE: >> "text/html" FINE: >> "text/html" FINE: >> "text/html" FINE: >> "; charset=" FINE: >> "; charset=" FINE: >> "; charset=" FINE: >> "ISO-8859-1" FINE: >> "ISO-8859-1" FINE: >> "ISO-8859-1" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "36" FINE: >> "36" FINE: >> "36" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "--" FINE: >> "--" FINE: >> "--" FINE: >> "konfrJlfCo5UFxj71JEBaN30gbcAgkFmDvN7c-73" FINE: >> "konfrJlfCo5UFxj71JEBaN30gbcAgkFmDvN7c-73" FINE: >> "konfrJlfCo5UFxj71JEBaN30gbcAgkFmDvN7c-73" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "Content-Disposition: form-data; name=" FINE: >> "Content-Disposition: form-data; name=" FINE: >> "Content-Disposition: form-data; name=" FINE: >> """ FINE: >> """ FINE: >> """ FINE: >> "upload_file.y" FINE: >> "upload_file.y" FINE: >> "upload_file.y" FINE: >> """ FINE: >> """ FINE: >> """ FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "Content-Type: " FINE: >> "Content-Type: " FINE: >> "Content-Type: " FINE: >> "text/html" FINE: >> "text/html" FINE: >> "text/html" FINE: >> "; charset=" FINE: >> "; charset=" FINE: >> "; charset=" FINE: >> "ISO-8859-1" FINE: >> "ISO-8859-1" FINE: >> "ISO-8859-1" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "12" FINE: >> "12" FINE: >> "12" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "--" FINE: >> "--" FINE: >> "--" FINE: >> "konfrJlfCo5UFxj71JEBaN30gbcAgkFmDvN7c-73" FINE: >> "konfrJlfCo5UFxj71JEBaN30gbcAgkFmDvN7c-73" FINE: >> "konfrJlfCo5UFxj71JEBaN30gbcAgkFmDvN7c-73" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "Content-Disposition: form-data; name=" FINE: >> "Content-Disposition: form-data; name=" FINE: >> "Content-Disposition: form-data; name=" FINE: >> """ FINE: >> """ FINE: >> """ FINE: >> "upload_file" FINE: >> "upload_file" FINE: >> "upload_file" FINE: >> """ FINE: >> """ FINE: >> """ FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "Content-Type: " FINE: >> "Content-Type: " FINE: >> "Content-Type: " FINE: >> "text/html" FINE: >> "text/html" FINE: >> "text/html" FINE: >> "; charset=" FINE: >> "; charset=" FINE: >> "; charset=" FINE: >> "ISO-8859-1" FINE: >> "ISO-8859-1" FINE: >> "ISO-8859-1" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "uploadfile" FINE: >> "uploadfile" FINE: >> "uploadfile" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "--" FINE: >> "--" FINE: >> "--" FINE: >> "konfrJlfCo5UFxj71JEBaN30gbcAgkFmDvN7c-73" FINE: >> "konfrJlfCo5UFxj71JEBaN30gbcAgkFmDvN7c-73" FINE: >> "konfrJlfCo5UFxj71JEBaN30gbcAgkFmDvN7c-73" FINE: >> "--" FINE: >> "--" FINE: >> "--" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: >> "[\r][\n]" FINE: << "HTTP/1.1 500 Internal Server Error[\r][\n]" FINE: << "HTTP/1.1 500 Internal Server Error[\r][\n]" FINE: << "HTTP/1.1 500 Internal Server Error[\r][\n]" FINE: << "HTTP/1.1 500 Internal Server Error[\r][\n]" FINE: << "HTTP/1.1 500 Internal Server Error[\r][\n]" FINE: << "HTTP/1.1 500 Internal Server Error[\r][\n]" FINE: << "Date: Fri, 12 Jun 2009 12:14:56 GMT[\r][\n]" FINE: << "Date: Fri, 12 Jun 2009 12:14:56 GMT[\r][\n]" FINE: << "Date: Fri, 12 Jun 2009 12:14:56 GMT[\r][\n]" FINE: << "Server: WebSphere Application Server/6.0[\r][\n]" FINE: << "Server: WebSphere Application Server/6.0[\r][\n]" FINE: << "Server: WebSphere Application Server/6.0[\r][\n]" FINE: << "Content-Type: text/html;charset=ISO-8859-1[\r][\n]" FINE: << "Content-Type: text/html;charset=ISO-8859-1[\r][\n]" FINE: << "Content-Type: text/html;charset=ISO-8859-1[\r][\n]" FINE: << "$WSEP: [\r][\n]" FINE: << "$WSEP: [\r][\n]" FINE: << "$WSEP: [\r][\n]" FINE: << "Content-Language: en-US[\r][\n]" FINE: << "Content-Language: en-US[\r][\n]" FINE: << "Content-Language: en-US[\r][\n]" FINE: << "Via: 1.1 xyz.com[\r][\n]" FINE: << "Via: 1.1 xyz.com[\r][\n]" FINE: << "Via: 1.1 xyz.com[\r][\n]" FINE: << "Connection: close[\r][\n]" FINE: << "Connection: close[\r][\n]" FINE: << "Connection: close[\r][\n]" FINE: << "Transfer-Encoding: chunked[\r][\n]" FINE: << "Transfer-Encoding: chunked[\r][\n]" FINE: << "Transfer-Encoding: chunked[\r][\n]" FINE: << "[\r][\n]" FINE: << "[\r][\n]" FINE: << "[\r][\n]" FINE: << "3" FINE: << "3" FINE: << "3" FINE: << "e" FINE: << "e" FINE: << "e" FINE: << "1" FINE: << "1" FINE: << "1" FINE: << "[\r]" FINE: << "[\r]" FINE: << "[\r]" FINE: << "[\n]" FINE: << "[\n]" FINE: << "[\n]" FINE: << "[\r][\n]" FINE: << "[\r][\n]" FINE: << "[\r][\n]" FINE: << "[\r][\n]" FINE: << "[\r][\n]" FINE: << "[\r][\n]" The browser application: POST /Example/retail/protected/uploadFile HTTP/1.1 Host: xyz.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: https://xyz.com/Example/retail/protected/uploadfile/pre Cookie: JSESSIONID=0000ZhDKJ9v1BGf0Bu8iIJU1xHR:-1; LtpaToken=6m8+vJZcVeNR+pLQOElXHBLSB3v6FN/rjp0Qq+7w9crXzZVN1gAbtsb28kPf5KIxALGZhaZUiwE/eNvdaoqu9rfXefpzpH9Hr6L9chvMnDxMGhZUE56A8muiB6A5Ijhmof6Xix/UwIXmQc+01TRaW7sHB+ZWenTBEGl8Bne4G/GdqTMXoSKPb1r5DegoJi4Abw+vbPH4KrUtHiMpONOfRLjHaNFfjwfIlUCTE54ntoQ1yrddzFadRV+hFhphmTB3Mi5bLUQYv6Fp6kXRMRODxcIsBu6VYyFL2aA//GPhJMhAvk3DmJ6Wwg== Content-Type: multipart/form-data; boundary=---------------------------41184676334 Content-Length: 1271 -----------------------------41184676334 Content-Disposition: form-data; name="fileType" Issue -----------------------------41184676334 Content-Disposition: form-data; name="theFile"; filename="Test.txt" Content-Type: text/plain 000000000002222220000123439200704110099384900CDELSYS Rule - TDELSYS Rule - Payee Name Field XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX1 000000000002222220000123440200704119938491201 Text Field Maximum Amount Length 000000000002222220000123440200704110099384900 DELSYS Rule - TDELSYS Rule - Payee Name Field XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX1 -----------------------------41184676334 Content-Disposition: form-data; name="upload_file.x" 33 -----------------------------41184676334 Content-Disposition: form-data; name="upload_file.y" 12 -----------------------------41184676334 Content-Disposition: form-data; name="upload_file" uploadfile -----------------------------41184676334-- HTTP/1.x 200 OK Date: Tue, 09 Jun 2009 14:02:05 GMT Server: WebSphere Application Server/6.0 Content-Type: text/html;charset=ISO-8859-1 Content-Language: en-US Via: xyz.com Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Transfer-Encoding: chunked --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@... For additional commands, e-mail: httpclient-users-help@... |
|
|
Re: Upload file - multipartDanny Gallagher wrote:
> Strange, it would not let me post the message with the logs in the body. > Bounced back as exceeding spam threshold. Do I post them as attachments? > > -----Original Message----- > From: Danny Gallagher [mailto:danny.gallagher@...] > Sent: Friday, June 12, 2009 8:52 AM > To: httpclient-users@... > Subject: Upload file - multipart > > I am attempting to upload a file to a server, using HttpClient to talk > to > > the server application. > > > > The user I am logging in with is able to successfully upload a file > through a browser. > > > > When I attempt the same request in my application code, the server > returns a 500 error. > > I don't have access to the server, so I cannot look at the logs to see > what causes the 500. > > In my application code. > > > > In my application, I get logged in, receive the proper cookies from the > server, etc. > > My file upload request and the one sent through the browser are the > same, or very similar, as far as I can tell. > > I searched the mail list archives for file upload and tried the > suggestions that I found there to no avail. > > > > Here are the logs from both my application and the browser application, > as it relates to the file upload post. > > Any help is much appreciated. > > > > Thanks, > > > > Danny > > Hi Danny The server application may not like the Content-Type header sent by HttpClient. I recommend upgrading to HttpClient 4.0, which provides a much better support for multipart content including a browser compatibility mode. Hope this helps Oleg > > > > > > ------------------------------------------------------------------------ > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: httpclient-users-unsubscribe@... > For additional commands, e-mail: httpclient-users-help@... --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@... For additional commands, e-mail: httpclient-users-help@... |
| Free embeddable forum powered by Nabble | Forum Help |