I have a WCF service which transport mode is set to Streamed. The service need to accept a stream.
My Client is Compact Framework 3.5. In the client I have n list object that carries large data. I want to serialize this object to stream and send it to WCF service where I will deserialize it.
This turn out to be a mission because of the limited serialization options in Compact Framework.
Currently I have the following for the serializing:
ServiceClient sc = new ServiceClient(CommonClient.MyDefaultBinding(), CommonClient.MyEndpointAddress);
MemoryStream s = new MemoryStream();
XmlSerializer serializer = new XmlSerializer(typeof(ScannerService.AscAssetCaptureCollection));
serializer.Serialize(s, serverCollection);
OnComplete(sc.Send((Stream)s));
This is not working. The error I'm getting when trying to send is:
The type System.IO.MemoryStream was not expected. Use the XmlInclude or SoapInclude >attribute to specify types that are not known statically.
Does anyone know how can I achieve this?
There's no streaming from .NET CF. Because of memory limitations, the WCF version for .NET CF/WIN CE has a dramatically abbreviated tool set. The only option in your case for uploading files from a .NET CF device is buffering, though CF might be able to receive a stream (not sure. I've never tried it.) You're limited, too, in your binding options and encryption - SSL won't work, only message encryption.
Here's a link to the subset of features available in .NET 3.5 CF
http://blogs.msdn.com/b/andrewarnottms/archive/2007/08/21/the-wcf-subset-supported-by-netcf.aspx
Good luck ... I was able to get files uploading/downloading to CF, but it wasn't easy.