As HttpInvoker relies on Java serialization there's no way that your going to be able to remote that interface as streams are not serializable. However, what you could do is adapt the interface to a statefull file transfer service that send the file across the wire in chunks using multiple remote invocations:
Code:
interface ChunkedFileTransferService {
int beginSend(Long fileId);
void sendChunk(int transferKey, byte[] cunk);
void endSend(int transferKey);
}
class FileServiceAdapter implements FileService {
private ChunkedFileTransferService cfts;
void putFile(Long fileId, InputStream stream) {
int transferKey = cfts.beginSend(fileId);
byte[] buffer = new byte[1024];
while (data left to read) {
stream.read(buffer);
cfts.sendChunk(transferKey, buffer);
}
cfts.endSend(transferKey);
}
...
}
This is also nice as it makes it easy to implement things like a progess bar.
HTH
Ollie