<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Remoting</title>
        <link>http://geekswithblogs.net/khanna/category/548.aspx</link>
        <description>Remoting</description>
        <language>en-US</language>
        <copyright>Gaurav Khanna</copyright>
        <managingEditor>gaurav@wintoolzone.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>SoapSuds and Remoting - Issues using CAO under .NET Framework 1.1</title>
            <link>http://geekswithblogs.net/khanna/archive/2004/05/14/4893.aspx</link>
            <description>&lt;P&gt;&lt;FONT face=Georgia size=2&gt;Over the past weekend, I was working on implementing a Remoting Server that would serve CAO (Client Activated Object)&amp;nbsp;to my Remoting client. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Georgia size=2&gt;Went ahead, implemented the Remotable class and did a &lt;A href="http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemruntimeremotingremotingconfigurationclassregisteractivatedservicetypetopic.asp"&gt;&lt;EM&gt;RegisterActivatedServiceType&lt;/EM&gt;&lt;/A&gt;. Then, for the Remoting client to have the metadata, I used the &lt;EM&gt;&lt;A href="http://msdn.microsoft.com/library/en-us/cptools/html/cpgrfSoapsudsUtilitySoapSudsexe.asp"&gt;SoapSuds &lt;/A&gt;&lt;/EM&gt;extract the metadata and provide reference to the client. So far so good.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Georgia size=2&gt;But then I executed my client, I got a deserialization error. Here's the Microsoft KB article that discusses this error:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.microsoft.com/default.aspx?scid=kb;en-us;823445"&gt;http://support.microsoft.com/default.aspx?scid=kb;en-us;823445&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Georgia size=2&gt;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:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Georgia size=2&gt;1) Write your Remotable class which is &lt;EM&gt;MarshalByRefObject&lt;BR&gt;&lt;BR&gt;&lt;/EM&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;class MyRemotableClass : MarshalByRefObject, IRemotableClass&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp; // implementation comes here&lt;BR&gt;}&lt;/FONT&gt;&lt;BR&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Georgia size=2&gt;&lt;BR&gt;&lt;EM&gt;IRemotableClass &lt;/EM&gt;is the interface that your class implements and will be shared with the client to provide it with metadata.&lt;BR&gt;&lt;BR&gt;2) Write a &lt;EM&gt;factory &lt;/EM&gt;class that will be create a new instance of your Remotable class:&lt;BR&gt;&lt;BR&gt;&lt;FONT face=Arial&gt;&lt;EM&gt;class MyRemotableClassFactory : MarshalByRefObject, IRemotableClassFactory&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // This is the factory method that will return a new instance of the RemotableClass;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Thus, we have a CAO behaviour.&lt;BR&gt;&amp;nbsp;&amp;nbsp; public IRemotableClass GetNewInstanceOfRemotableClass()&lt;BR&gt;&amp;nbsp;&amp;nbsp; [&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return new MyRemotableClass();&lt;BR&gt;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;}&lt;BR&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Georgia size=2&gt;&lt;FONT face=Arial&gt;&lt;BR&gt;&lt;FONT face=Georgia&gt;&lt;EM&gt;IRemotableClassFactory &lt;/EM&gt;interface serves the same purpose as &lt;EM&gt;IRemotableClass &lt;/EM&gt;interface above.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Georgia size=2&gt;&lt;FONT face=Arial&gt;&lt;FONT face=Georgia&gt;3) Now, write your Remoting client that connects to the server (which got activated using &lt;EM&gt;RegisterWellKnownServiceType) &lt;/EM&gt;using &lt;EM&gt;RegisterWellKnownClientType.&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Georgia size=2&gt;&lt;FONT face=Arial&gt;&lt;FONT face=Georgia&gt;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!&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=4893"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=4893" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/khanna/aggbug/4893.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Gaurav Khanna</dc:creator>
            <guid>http://geekswithblogs.net/khanna/archive/2004/05/14/4893.aspx</guid>
            <pubDate>Sat, 15 May 2004 00:26:00 GMT</pubDate>
            <comments>http://geekswithblogs.net/khanna/archive/2004/05/14/4893.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/khanna/comments/commentRss/4893.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/khanna/services/trackbacks/4893.aspx</trackback:ping>
        </item>
    </channel>
</rss>