How to send XmlElement and SoapHeader over .NET Remoting?
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.remoting.

Post a new message to this list...

Davor Capalija
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

Reply to this message...
 
    
Ken Kolda
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" <Click here to reveal e-mail address> wrote in message
news:0fcf01c49977$e5e45180$Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
 
System.Collections.Specialized.ListDictionary
System.Runtime.Remoting.Channels.ChannelServices
System.Runtime.Remoting.Channels.Http.HttpChannel
System.Runtime.Remoting.Channels.SoapClientFormatterSinkProvider
System.Runtime.Remoting.Channels.SoapServerFormatterSinkProvider
System.Runtime.Remoting.ObjRef
System.Runtime.Remoting.RemotingServices
System.Runtime.Serialization.ISerializable
System.Runtime.Serialization.SerializationException
System.Web.Services.Protocols.SoapHeader
System.Xml.XmlElement




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com