在客户端,一个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
- public string RTX_SendIM(string sSender, string sPwd, string sMsg, string sSessionID, string sReceiver)
- {
- string sErr = "";
- try
- {
- RTXSAPILib.RTXSAPIRootObj RootObj = new RTXSAPIRootObj(); //创建根对象
- RootObj.SendIM(sSender, sPwd, sReceiver, sMsg, sSessionID);
- }
- catch (Exception ex)
- {
- sErr = ex.Message;
- }
- return sErr;
- }
客户端:
[csharp] view plaincopy
[csharp] view plaincopy
- private void btnWCF_Click(object sender, EventArgs e)
- {
- AAA.Service se = new AAA.Service();
- if (cboWcfAddress.Text != "")
- se.Url = cboWcfAddress.Text;
- Guid id = Guid.NewGuid();
- string sessionId = "{" + id.ToString() + "}";
- string sErr = se.RTX_SendIM(txtSender.Text, txtSenderPwd.Text, txtMsg.Text, sessionId, txtReceiver.Text);
- if (!string.IsNullOrEmpty(sErr))
- MessageBox.Show(sErr);
- }
2, vb6版 (客户端需要安装 SOAPToolKit )
下载地址: http://good.gd/1936572.htm
服务端就利用C#方案中的服务端
客户端:
[vb] view plaincopy
[csharp] view plaincopy
- Private Sub btnSendWcf_Click()
- On Error GoTo ERR
- Dim sGuid As String
- sGuid = CreateObject("Scriptlet.TypeLib").Guid
- Dim soapClient As New SoapClient30
- Dim text As String
- soapClient.MSSoapInit cboWcfAddress.text & "?wsdl"
- text = soapClient.RTX_SendIM(txtSender.text, txtSenderPwd.text, txtMsg.text, sGuid, txtReceiver.text)
- If (text <> "") Then
- MsgBox text
- End If
- Exit Sub
- ERR:
- MsgBox ERR.Description
- End Sub
备注:
调用WCF服务与调用WebService服务的方法一样!
如果1个rtx用户要给多个rtx用户发送即时消息,txtReceiver 中的内容用;(分号)隔开即可!
转载:http://blog.csdn.net/tf576776047/article/details/8845894
时间: 2024-10-12 07:54:40