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 plain copy
 
[csharp]  view plain copy
 
  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 plain copy
 
[csharp]  view plain copy
 
  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 plain copy
 
[csharp]  view plain copy
 
  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

 

程序員的基礎教程:菜鳥程序員


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM