国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

Using Web Services for Remoting over the Internet.

2024-07-21 02:27:49
字體:
供稿:網(wǎng)友
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.config
this 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="rkiss.webservicechannellib.sender, webservicechannellib" mode="soap"/>
   </channels>
  </application>
</system.runtime.remoting>
</configuration>
the ws is a custom remoting client channel to dispatch an imessage over internet using a binary respectively soap mode formatter. note that the mode is a customchannelproperty and its default value is binary.
web.config
this is a web service config file. the following snippet is its part. the web service gateway is also a local remoting client, therefore a client (sender) channel is requested to be registered. the following snippet shows a configuration of the two channels - tcp and msmq.
<system.runtime.remoting>
<application >
  <channels>
   <channel type="system.runtime.remoting.channels.tcp.tcpchannel, system.runtime.remoting"/>
   <channel type="rkiss.msmqchannellib.msmqsender, msmqchannellib"                  
            respond="./rspchannel" admin="./adminchannel" timeout="30" priority="10"/>
  </channels>
</application>
</system.runtime.remoting>
activating a remote object
the well known remote object (wko) is activated by its consumer using the getobject method mechanism. the proxy is created based on the remote object metadata assembly installed in the gac (see an argument objecttype). the remoting channel is selected by the objecturl argument. the url address in this solution has two parts :
  • connectivity to the web service gateway over internet
  • connectivity to the remote object over intranet within the web service gateway

between the primary and secondary addresses is a semicolon delimiter as it is shown the below:
string objecturl = @"ws://localhost/webservicelistener/listener.asmx; msmq://./reqchannel/endpoint";
using this objecturl design pattern allows an easy selection of the web service gateways on the internet. note that the ws custom remoting channel will trim this primary address and forward only its secondary part. in this solution, the objecturl represents a physical path of the logical connectivity between the consumer and remote object regardless of how many channels are needed. in this example, the web service gateway resides on the localhost and it should be replaced by the real machine name.
finally, the following code snippet shows an activation of the remote object:
// activate a remote object
type objecttype = typeof(myremoteobject.remoteobject);
string objecturl = @"ws://localhost/webservicelistener/listener.asmx; msmq://./reqchannel/endpoint";
remoteobject ro = (remoteobject)activator.getobject(objecttype, objecturl);
note that a metadata (assembly) of the remote object must be installed into the gac in the places such as client, web service gateway and server host.
that's all for the client/remoteobject plumbing issue over the internet.
the following pictures shows this connectivity:


    
now, to understand how the message flows between the heterogeneous channels over the internet, have a look at the following paragraphs:
 


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 尼勒克县| 铜山县| 宜章县| 湖南省| 阿合奇县| 砀山县| 庄河市| 碌曲县| 上饶市| 合水县| 江阴市| 灵石县| 托克托县| 丰县| 祥云县| 巴塘县| 桐柏县| 东乌珠穆沁旗| 怀宁县| 武威市| 永兴县| 庄浪县| 布尔津县| 扎鲁特旗| 凤冈县| 仙居县| 星座| 康马县| 乌恰县| 南丹县| 高碑店市| 东海县| 丰镇市| 胶州市| 博湖县| 桦南县| 平南县| 通辽市| 大安市| 儋州市| 红桥区|