views:

207

answers:

1

While developing WCF service i've faced problem of transferring large data as method params (> 4 Mb of raw size, not considering transfer/message overhead).

The solution for this problem is to use chunking or streaming, but all the samples i've seen assume client is aware of used method and uses available block size for sending/receiving portions of data, and the problem (for me) is that it's not possible to call just one method, like

SaveData(DataInformation info)

but write wrapper method which will instead iterate smth like

SaveDataChunk(byte[] buffer)

Could it be somehow made transparent for client, just calling 'SaveData'?

EDIT: Small additional question, though it could go to separate question If we use wcf streaming then all ServiceOperations in ServiceContract MUST fulfill addtional restrictions, like 'Operations that occur across a streamed transport can have a contract with at most one input or output parameter' ?

If service needs streaming for only part of the methods, you need to move it to another service contract? Is there another way to deal with it?

Thanks

A: 

Chunking or streamed is transparent to the code it is set in the configuration file.

If you use Data Transfer Objects for input and output, like your DataInformation object you will only have one parameter.

Your byte[] could be a property on the DTO.

Shiraz Bhaiji
Code sample could be great. Everything i've found uses Stream as operation contract parameterLike here http://csharp-codesamples.com/2009/02/data-transfer-using-self-hosted-wcf-service/Paragraph "The Service Contract and DataUploader Class"
bybor