Introduction This article describes a design and implementation (C#) of the Remoting over Internet using the Web Service as a gateway into the Remoting infrastructure. The Web Service Gateway (Custom Remoting Channel) allows to enhance the remoting channel over Internet and its chaining with another heterogeneous channel. Consuming a remote object over Internet is full transparently and it doesn't require any special implementation from the remoting via intranet. The Web Service Gateway enables to create a logical model of the connectivity between the different platforms and languages. Before than we will go to its implementation details, let's start it with usage and configuration issue. For some demonstration purpose I will use a MSMQ Custom Remoting Channel (
MSMQChannelLib.dll), which I described in my previously article [][1]#[1]]1]. I am assuming that you have a knowledge of the .Net Remoting and Web Service.
Usage Consuming a remote object over Internet using the Web Service Gateway is very straightforward and it actually requires only to install the following assemblies:
- WebServiceChannelLib , this is a Custom Remoting Channel on the client side to forward a remoting message to the Web Service Gateway over Internet (outgoing message).
- WebServiceListener, this is a Web Service (gateway) to listen an incoming message from the client side and forward it to the local remoting infrastructure (incoming message).
Note that the above assemblies have to be installed (into the GAC) both on the server and client sides when a remote callback is used.
The next step is to configure a server and client host sides. Their configuration are depended from the actually application. Let me assume, we want to call a remote object driven by MSMQ custom channel over internet. Their config files might look like the following snippets:
server.exe.config <configuration>
<system.runtime.remoting>
<application >
<service>
<wellknown mode="Singleton" type="MyRemoteObject.RemoteObject, MyRemoteObject"
objectUri="endpoint" />
</service>
<channels>
<channel type="RKiss.MSMQChannelLib.MSMQReceiver, MSMQChannelLib"
listener=".\ReqChannel"/>
<channel type="System.Runtime.Remoting.Channels.Tcp.TcpChannel, System.Runtime.Remoting"
port="8090" />
</channels>
</application>
</system.runtime.remoting>
</configuration>
The above server config file will register two channels to listen an incoming message for the remote well known singleton object.
client.exe.configThis is an example of the client config file to register our Custom Remoting Channel.
<configuration>
<system.runtime.remoting>
<application>
<client >
<wellknown type="MyRemoteObject.RemoteObject, RemoteObject"
url="ws://localhost/WebServiceListener/Listener.asmx;
tcp://localhost:8090/endpoint/RemoteObject" />
</client>
<channels>
<channel type=&