RTX二次开发笔记1

在客户端,一个rtx用户给另一个rtx用户发送消息!

   我的解决方案:在rtx服务端部署一个 wcf服务 或 webservice 服务,然后程序在客户端调用服务就行。

1,C#版 (服务端需要4个DLL)

    Interop.RTXCAPILib.dll

    Interop.RTXClient.dll

    Interop.RTXSAPILib.dll

    Interop.RTXServerApi.dll

   下载地址: http://good.gd/1936542.htm

服务端: (需引用上述4个dll)

[csharp] view plaincopy
 
[csharp] view plaincopy
 
  1. public string RTX_SendIM(string sSender, string sPwd, string sMsg, string sSessionID, string sReceiver)    
  2. {    
  3.     string sErr = "";    
  4.     try    
  5.     {    
  6.         RTXSAPILib.RTXSAPIRootObj RootObj = new RTXSAPIRootObj();     //创建根对象    
  7.     
  8.         RootObj.SendIM(sSender, sPwd, sReceiver, sMsg, sSessionID);    
  9.     }    
  10.     catch (Exception ex)    
  11.     {    
  12.         sErr = ex.Message;    
  13.     }    
  14.     return sErr;    
  15. }    

客户端:

[csharp] view plaincopy
 
[csharp] view plaincopy
 
  1. private void btnWCF_Click(object sender, EventArgs e)    
  2. {    
  3.     AAA.Service se = new AAA.Service();    
  4.     
  5.     if (cboWcfAddress.Text != "")    
  6.         se.Url = cboWcfAddress.Text;    
  7.     
  8.     Guid id = Guid.NewGuid();    
  9.     string sessionId = "{" + id.ToString() + "}";    
  10.     string sErr = se.RTX_SendIM(txtSender.Text, txtSenderPwd.Text, txtMsg.Text, sessionId, txtReceiver.Text);    
  11.     if (!string.IsNullOrEmpty(sErr))    
  12.         MessageBox.Show(sErr);    
  13. }    

2, vb6版 (客户端需要安装 SOAPToolKit )

   下载地址: http://good.gd/1936572.htm

服务端就利用C#方案中的服务端

客户端:

[vb] view plaincopy
 
[csharp] view plaincopy
 
  1. Private Sub btnSendWcf_Click()    
  2.     On Error GoTo ERR    
  3.     
  4.     Dim sGuid As String    
  5.     sGuid = CreateObject("Scriptlet.TypeLib").Guid    
  6.      
  7.     Dim soapClient As New SoapClient30    
  8.     Dim text As String    
  9.         
  10.     soapClient.MSSoapInit cboWcfAddress.text & "?wsdl"    
  11.      
  12.     text = soapClient.RTX_SendIM(txtSender.text, txtSenderPwd.text, txtMsg.text, sGuid, txtReceiver.text)    
  13.     If (text <> "") Then    
  14.         MsgBox text    
  15.     End If    
  16.       
  17.         
  18.     Exit Sub    
  19.      
  20. ERR:    
  21.     MsgBox ERR.Description    
  22. End Sub    


备注:


调用WCF服务与调用WebService服务的方法一样!

如果1个rtx用户要给多个rtx用户发送即时消息,txtReceiver 中的内容用;(分号)隔开即可!

转载:http://blog.csdn.net/tf576776047/article/details/8845894

程序员的基础教程:菜鸟程序员

原文地址:https://www.cnblogs.com/guohu/p/4326749.html