return version;\r
}\r
\r
- public bool check_connectivity()\r
- {\r
- /*\r
- It will check connection on given server url.\r
- \r
- :return : True or False.\r
- */\r
-\r
- this.Open(OpenERPClient.OpenERPService.Common);\r
- bool flag = this.rpcclient.check_connectivity();\r
- this.Close();\r
- return flag;\r
- }\r
-\r
\r
}\r
\r
[XmlRpcMethod("server_version")]\r
string ServerVersion();\r
\r
- [XmlRpcMethod("check_connectivity")]\r
- bool check_connectivity();\r
-\r
-\r
}\r
public interface Ixmlrpcconnect : IOpenERPCommon, IOpenERPDB, IOpenERPObject\r
{\r
{\r
return rpcclient.ServerVersion();\r
}\r
-\r
- public bool check_connectivity()\r
- {\r
- return rpcclient.check_connectivity();\r
- }\r
#endregion\r
\r
\r
using System;\r
using System.Windows.Forms;\r
using OpenERPClient;\r
+using System.Net;\r
+using System.IO;\r
+using System.Text;\r
+using System.Security;\r
+using System.Net;\r
+using System.Security.Cryptography.X509Certificates;\r
+using System.Net.Security;\r
\r
namespace OpenERPOutlookPlugin\r
{\r
}\r
}\r
\r
+ public static bool ValidateServerCertificate(\r
+ object sender,\r
+ X509Certificate certificate,\r
+ X509Chain chain,\r
+ SslPolicyErrors sslPolicyErrors)\r
+ {\r
+ // Somehow the cert always has PolicyErrors so I am returning true regardless.\r
+ return true;\r
+ }\r
\r
private void btn_server_ok_Click(object sender, EventArgs e)\r
{\r
OpenERPConnect openerp_connect = openerp_outlook.Connection;\r
string url = Tools.JoinURL(this.txt_server_host.Text, this.txt_server_port.Text, this.chkSSL.Checked);\r
this.txtServerURL.Text = url;\r
- openerp_connect.check_connectivity();\r
+ if (this.chkSSL.Checked)\r
+ {\r
+ ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(ValidateServerCertificate);\r
+ }\r
this.Close();\r
}\r
catch (Exception ex)\r
this.Close();\r
}\r
\r
-\r
+ private void chkSSL_CheckedChanged(object sender, EventArgs e)\r
+ {\r
+ if (this.chkSSL.Checked)\r
+ {\r
+ txt_server_port.Text = "443";\r
+ }\r
+ else\r
+ {\r
+ txt_server_port.Text = "8069";\r
+ }\r
+ }\r
}\r
}\r