Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting Different File Sizes from the server.

 
pavan aryan
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for the title. It will be a long story for my error..to be precise. I am doing a cross study between SOAP and REST and their features. Now working on Files..say client request a file from the server and server returns it. To make it more challenging and for load testing i choosen Image files. of sizes 5mb-40mb ( i developed myself using photoshop ) . So for the SOAP not to depend on SAAJ and MTOM, i followed different examples and made a custom code myself.

Coming to here, the server returns an image, i converted image to byte array and returned to client. At the Client i am storing it to files locally..now the problem I am getting files of different sizes from server (dont know problem with serverlogic or client logic). A file of 5 mb from the server , stores as 3.34mb first time and later 900 kb second time and 3.34mb again not the 5 mb. I am Using Net Beans 6.7 and Glass Fish V3 Prelude.

Server Code


Client Side Code



All this i am doing from long time, now at the time i am getting some results.. this was happening. Please Help me guys i am very very close to my deadline.
Looks like some compression is going..not gettign wether at server side or client side :'(

THanks,
Kumar
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
I am not sure about the cause of your problems, but since you have rather large files, I would suggest another strategy:
- Change the return type of the atttest method to javax.activation.DataHandler.
- Do not read the file into memory, but instead use an instance of FileDataSource like this:

Hope this helps!
 
pavan aryan
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ivan Krizsan wrote:Hi!
I am not sure about the cause of your problems, but since you have rather large files, I would suggest another strategy:
- Change the return type of the atttest method to javax.activation.DataHandler.
- Do not read the file into memory, but instead use an instance of FileDataSource like this:

Hope this helps!



thanks Ivan Krizsan for the solution yes it is working i am having problem at client side to store locally. I am gettting the image in bytearray at client side i tried various ways to convert the bytearray to file and store locally..but the file being stored was of different file size ..i am using bytearray.length at the client side and its returning same sizes for small images...i think i am messing at the clien side...sorry for asking again..please show me a solution..the code i have been trying

Server Side


Client side



Thanks in advance,
Kumar.
 
pavan aryan
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i fixed my problem..thanks to Ivan for major help. i just got something and opened my complete referene (took time to find it ) and got these two lines of code that fixed the problem..



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic