custom serialization with SoapExtension

  • Thread starter Frederik Vanderhaegen
  • Start date

F

Frederik Vanderhaegen

Hi,

I'm writing a webservice which returns a custom object, e.g. public Broker
GetBrokerById(int BrokerId){ //some code }.
My problem is the following, the broker object can't be marked serializable
because there would be problems with other applications using this class.
So I thought to write a SoapExtension which de/serializes the object by the
use of a class that implements the ISerializationSurrogate interface.
I'm able to de/serialize the object with the surrogate class but the
problems start when I have to implement it into the ProcessMessage method.
If the message is a ServerSoapMessage, I retrieve the ReturnValue is the
BeforeSerialize stage, save it in a temp memory stream and in the
AfterSerialize I replace the outgoing stream (because it contains an error
message saying that the object isn't serializable) by the temp memory
stream.
The client receives the SoapMessage perfect, I can deserialize it but I
don't know how I can pass it back to the function who made the request.
Does anyone know how I can realize this?
Or is this the wrong way to accomplish this?

Any help is welcome

Thanks in advance

Frederik
 
Ad

Advertisements


Top