Beispiel #1
0
        public static void GetResource(string ip, int port)
        {
            Trace.TraceInformation("初始化连接");
            BasicHttpBinding bhb = new BasicHttpBinding()
            {
                MaxBufferSize          = MAX_SIZE,
                MaxReceivedMessageSize = MAX_SIZE,
                ReaderQuotas           = new System.Xml.XmlDictionaryReaderQuotas()
                {
                    MaxStringContentLength = MAX_SIZE
                }
            };
            string url = string.Format("http://{0}:{1}/vms/services/VmsSdkWebService.VmsSdkWebServiceHttpSoap11Endpoint/", ip, port);

            _ws = new VmsSdkWebServicePortTypeClient(bhb, new EndpointAddress(url));
        }
 public PlatformService(string ip, int port)//根据服务器ip、port动态加载平台服务
 {
     Trace.TraceInformation("加载平台服务");
     if (Program.LoginInfo.IsHttps == 1)
     {
         ServicePointManager.ServerCertificateValidationCallback = RemoteCertificateValidate;
         BasicHttpBinding bhb = new BasicHttpBinding()
         {
             MaxBufferSize          = MAX_SIZE,
             MaxReceivedMessageSize = MAX_SIZE,
             Security = new BasicHttpSecurity()
             {
                 Mode = BasicHttpSecurityMode.Transport
             },
             ReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas()
             {
                 MaxStringContentLength = MAX_SIZE
             }
         };
         string url = string.Format("https://{0}:{1}/vms/services/VmsSdkWebService.VmsSdkWebServiceHttpSoap11Endpoint/", ip, port);
         _ws = new VmsSdkWebServicePortTypeClient(bhb, new EndpointAddress(url));
     }
     else
     {
         BasicHttpBinding bhb = new BasicHttpBinding()
         {
             MaxBufferSize          = MAX_SIZE,
             MaxReceivedMessageSize = MAX_SIZE,
             ReaderQuotas           = new System.Xml.XmlDictionaryReaderQuotas()
             {
                 MaxStringContentLength = MAX_SIZE
             }
         };
         string url = string.Format("http://{0}:{1}/vms/services/VmsSdkWebService.VmsSdkWebServiceHttpSoap11Endpoint/", ip, port);
         _ws = new VmsSdkWebServicePortTypeClient(bhb, new EndpointAddress(url));
         Trace.TraceInformation("平台服务加载完毕");
     }
 }