Need to transfer large file content from wcf service to java client (java web app)

1k Views Asked by At

basically need to transfer large file between wcf service and java client, can someone give directions please?

Basically I need to a create wcf service which needs to read blob content(actually a file content stored in db column) and pass it to a java web application(being a client to wcf).

File size may vary from 1kb to 20MB in size. By now I have already researched/checked below options but still not able to finalize which one i should go with, which is feasible and which is not, could someone guide me please.

  1. pass file content as byte[]: I understand it will increase data size passed to client as it will encode data into base 64 format and embed the base 64 encoding into soap message itself and hence makes communication slower and have performance issues. But this works for sure, but I am not sure if it is advisable to go by this approach.

  2. Share a NetworkDrive/FTPFolder accessible to both client and wcf service App: Per this File needed by client will first get stored there by wcf and then client needs to use java I/O OR FTP options to read it. This looks good from data size/bandwidth point of view, but has extra processing at both service and client side (as need to store/read via NetworkShared/FTP folder)

  3. Streaming: This one I am not sure will be feasible with a Java client, but my understanding is that streaming is supported for Non .net clients but how to go about it i am not sure??? I understand for streaming i need to use basichttp binding, but do i need to use DataContract or MessageContract or any will work, and then what is to be done at java client side, that i am not sure about.
  4. Using MTOM approach for passing large data in soap requests: This looks actually having support specifically designed to solve large data transfer in web service calls, but have to investigate further on this, as of now I don’t have much idea on this. Does anyone of you have some suggestion on this?

I understand question is bit lengthier but i had to put all 4 options i have tried and my concerns/findings with each, so that you all can suggest among these or new option may be, also you will know what i have already tried and so can direct me in more effective way.

1

There are 1 best solutions below

3
On

I am in the same position as yourself and I can state from experience that option 1 is a poor choice for anything more than a couple of MB.

In my own system, times to upload increase exponentially, with 25MB files taking in excess of 30mins to upload.

I've run some timings and the bulk of this is in the transfer of the file from the .NET client to the Java Web Service. Our web service is a facade for a set of 3rd party services; using the built in client provided by the 3rd party (not viable in the business context) is significantly faster - less than 5mins for a 25MB file. Upload to our client application is also quick.

We have tried MTOM and, unless we implemented it incorrectly, didn't see huge improvements (under 10% speed increase).

Next port of call will be option 2 - file transfers are relatively quick so by uploading the file directly to one of the web service hosts I'm hoping this will speed things up dramatically - if I get some meaningful results I will add them to my post.