views:

34

answers:

1

Hi,

is there a way to write ( a string for example ) directly to the output stream, when implementing a regular WCF interface like this:

[ServiceContract]
public interface ISearchInterface
{
    [OperationContract]
    [FaultContract(typeof(Exception))]
    SearchResponse SearchXML(SearchRequest req);
}

I want to save de/serialization time and send the serialzed string directly( it HAS to be the same method, though, because when i haven't got the serialized cachestring, i want to normally "build" the serialized object by some SQL statements... )

Any ideas? Something like

Channel.Write(s);

??

A: 

In one word: NO.

WCF is a message-based communication system - there is NO direct link between the server and your client at any time. All that goes between client and server are serialized messages - you can only exchange static data - there's no "object remoting" capability or anything like that in WCF. Heck - the messages between client and server could be sent by pigeons for all I know. And no, there's no way to send something back "directly over the channel" bypassing serialization - the response from the server must be serialized into a message and that message is sent back as a response to the client.

marc_s
i guess you got me a littl wrong... i want to bypass the process of serialization, that WCF does, because i already serialzed the data myself... see, the idea is to store serialzed data to a cache ( memcache ).. so, instead auf deserializing them and let them be serialized again by WCF, i want to directly put it through ( maybe a serializer overload is the method of choice here? )
David
I don't know of anything like that. You can do certain things on the server side to implement sort of a caching - but I've never heard of a way to circumvent the serialization process.
marc_s