views:

1490

answers:

3

I am looking for a solution to upload a file from a client to a server connected through a web service. The client is written in c# and the web Service in java. The files can be rather large < 100MB.

What approach would you suggest is best ?

+1  A: 

Base64 encode the file and send it as an attachment. If you need to make sure the contents of the attachment do not get changed en route, use MTOM. Otherwise, use DIME.

R Ubben
+1  A: 

Agree an encoding on both client and server then serialize the file using that encoding, wrap it in CDATA tags and assign the value to a text node in your SOAP request on the client.

Read the data between the CDATA tags on the server, deserialize it using the agreed encoding and you'll have the byte stream to use as need be.

It's probably a good idea for the encoding to involve some sort of compression if the files are large, although be wary of interop issues if the client is .NET and the server Java.

Nick Holt
A: 

For the server side, you should have a look at Commons File Upload

Valentin Rocher
The Commons File Upload is designed to work with HTML Forms and will rely on you having access to the HTTP request in both the client and server, which isn't usually the case with the common WS APIs.
Nick Holt