Inside and Out…

An attempt to understand technology better…

Archive for May, 2004

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

Posted in .NET Framework, Development, Distributed Communications, Tips | Leave a Comment »

Disclaimer

Posted by Gaurav Khanna on May 1, 2004

The information in this weblog is provided “AS IS” with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion. Inappropriate comments will be deleted at the authors discretion. All code samples are provided “AS IS” without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

Posted in General | 1 Comment »