Ken Kolda
9/13/2004 5:35:00 PM
As the message points out, the SoapHeader class isn't Serializable. When a
derived class is marked as [Serializable] but its base class is not, you
must implement the ISerializable interface so you can control serialization
of the object yourself. That said, the fact that the SoapHeader class is
neither serializable nor MarshalByRef means you generally shouldn't be
trying to pass it across a remoting interface.
What's the reason you're trying to pass a SoapHeader via remoting? Will the
server side then use this header to invoke a web service? If that's the
case, what you probably need to do is pass some other serializable data
structure which your server turns into a SoapHeader object.
Ken
"Davor Capalija" <davor.capalija@inet.hr> wrote in message
news:0fcf01c49977$e5e45180$a301280a@phx.gbl...
> Hi!
>
> I'm currently working on project where we use class like
> this one:
>
> [Serializable]
> class EndpointReferenceType : SoapHeader { ... }
>
> Next code section shows how server side of .NET Remoting
> is registered:
>
> {
> int listenPort=3000;
> ListDictionary channelProperties = new ListDictionary();
> channelProperties.Add("name", "");
> channelProperties.Add("port", listenPort);
>
> httpChannel = new HttpChannel( channelProperties,
> new SoapClientFormatterSinkProvider(),
> new SoapServerFormatterSinkProvider());
>
> ChannelServices.RegisterChannel(httpChannel);
>
> sessionContainer=new EventChannelSubscriberSessionContainer
> ();
>
> ObjRef objrefWellKnown = RemotingServices.Marshal
> (sessionContainer,"EventChannelSubscriberSessionContainer")
> ;
> }
>
> During invocation of a method from client side of
> connection:
>
> {
> session.Notify(new Event(null,xmlElement),new
> EndpointReferenceType());
> }
>
> where xmlElement is instance of XmlElement.
>
>
> and error occurs:
>
> "System.Runtime.Serialization.SerializationException ... :
> the type SoapHeader (also XmlElement) is not marked as
> serializable"
>
> Is there solution for this kind of a problem? What is
> elegant and easy way to send these classes as parameters
> over .NET Remoting?
>
> Thanx in advace,
> Davor
>