Inside and Out…

An attempt to understand technology better…

SoapSuds and Remoting – Issues using CAO under .NET Framework 1.1

Posted by Gaurav Khanna on May 14, 2004

Over the past weekend, I was working on implementing a Remoting Server that would serve CAO (Client Activated Object) to my Remoting client.

Went ahead, implemented the Remotable class and did a RegisterActivatedServiceType. Then, for the Remoting client to have the metadata, I used the SoapSuds extract the metadata and provide reference to the client. So far so good.

But then I executed my client, I got a deserialization error. Here’s the Microsoft KB article that discusses this error:

http://support.microsoft.com/default.aspx?scid=kb;en-us;823445

Ofcourse, you will need to get the service pack to get around this problem. But what do you do if that’s not available? So, here’s a workaround to this issue is this:

1) Write your Remotable class which is MarshalByRefObject

class MyRemotableClass : MarshalByRefObject, IRemotableClass
{
// implementation comes here
}

IRemotableClass is the interface that your class implements and will be shared with the client to provide it with metadata.

2) Write a factory class that will be create a new instance of your Remotable class:

class MyRemotableClassFactory : MarshalByRefObject, IRemotableClassFactory
{
// This is the factory method that will return a new instance of the RemotableClass;
// Thus, we have a CAO behaviour.
public IRemotableClass GetNewInstanceOfRemotableClass()
[
return new MyRemotableClass();
}
}

IRemotableClassFactory interface serves the same purpose as IRemotableClass interface above.

3) Now, write your Remoting client that connects to the server (which got activated using RegisterWellKnownServiceType) using RegisterWellKnownClientType.

And you have a CAO implementation for yourself 🙂 BTW, this issue is observed when the Remoting Server is running on .NET Framework 1.1 and not 1.0!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: