コード例 #1
0
        //private static Uri _baseAddress = new Uri("http://localhost:2997/");
        //private static string _address = "http://localhost:2997/VTLInt_WS.svc";

        public static VTLInt_Service.ServiceClient GetClient(ApplicationSettings.classes.services.ApplicationSettings.WebServiceInfo WSInfo)
        {
            try
            {
                _address     = WSInfo.WebService_public_URL;
                _baseAddress = new Uri(_address.Substring(0, _address.LastIndexOf('/') + 1));

                BasicHttpBinding binding = new BasicHttpBinding();
                binding.MaxReceivedMessageSize = 20000000;
                binding.MaxBufferSize          = 20000000;
                binding.MaxBufferPoolSize      = 20000000;
                binding.AllowCookies           = true;
                XmlDictionaryReaderQuotas readerQuotas = new XmlDictionaryReaderQuotas();
                readerQuotas.MaxArrayLength         = 20000000;
                readerQuotas.MaxStringContentLength = 20000000;
                readerQuotas.MaxDepth = 32;
                binding.ReaderQuotas  = readerQuotas;
                if (_baseAddress.Scheme.ToLower() == "https")
                {
                    binding.Security.Mode = BasicHttpSecurityMode.Transport;
                }

                VTLInt_Service.ServiceClient client = new VTLInt_Service.ServiceClient(binding, new EndpointAddress(_address));

                return(client);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #2
0
        private void ValWSbuttonModify_Click(object sender, EventArgs e)
        {
            try
            {
                MainApplicationSettings.WebServiceInfo tmp = new ApplicationSettings.classes.services.ApplicationSettings.WebServiceInfo();
                tmp = _tmp_settings.ValidationWebService;

                if (tmp != null)
                {
                    frmAddWebService frmMod = new frmAddWebService();
                    frmMod.DetailImplementationVisible = false;
                    frmMod.Modify = true;
                    frmMod.WSInfo = tmp;

                    if (frmMod.ShowDialog() == DialogResult.OK)
                    {
                        _tmp_settings.ValidationWebService = frmMod.WSInfo;
                        ValWSlabelName.Text        = _tmp_settings.ValidationWebService.WebService_Name;
                        ValWSlabelDescription.Text = _tmp_settings.ValidationWebService.WebService_Description;
                        ValWSlabelWSUrl.Text       = _tmp_settings.ValidationWebService.WebService_public_URL;
                        ValWSlabelUser.Text        = _tmp_settings.ValidationWebService.WebService_UserName;
                        ValWSlabelPwd.Text         = _tmp_settings.ValidationWebService.WebService_Password;
                    }
                }
            }
            catch (Exception ex)
            {
                CommonItem.ErrManger.ErrorManagement(ex, false, this);
            }
        }
コード例 #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                MainApplicationSettings.WebServiceInfo tmpIntWs = new ApplicationSettings.classes.services.ApplicationSettings.WebServiceInfo();
                tmpIntWs.WebService_Name        = this.IntWSlabelName.Text;
                tmpIntWs.WebService_Description = this.IntWSlabelDescr.Text;
                tmpIntWs.WebService_public_URL  = this.IntWSlabelUrl.Text;
                tmpIntWs.WebService_UserName    = this.IntWSlabelUser.Text;
                tmpIntWs.WebService_Password    = this.IntWSlabelPwd.Text;
                tmpIntWs.WebService_Crypted     = false;

                if (String.IsNullOrEmpty(tmpIntWs.WebService_public_URL.Replace("-", "")) || String.IsNullOrEmpty(tmpIntWs.WebService_Name.Replace("-", "")))
                {
                    if (MessageBox.Show("Interaction web service has not been set. If you continue the system will return some errors. Do you want to proceed without it? ", "Interaction ws", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return;
                    }
                }

                _tmp_settings.InteractionWebService = tmpIntWs;

                MainApplicationSettings.WebServiceInfo tmpValWs = new ApplicationSettings.classes.services.ApplicationSettings.WebServiceInfo();
                tmpValWs.WebService_Name        = this.ValWSlabelName.Text;
                tmpValWs.WebService_Description = this.ValWSlabelDescription.Text;
                tmpValWs.WebService_public_URL  = this.ValWSlabelWSUrl.Text;
                tmpValWs.WebService_UserName    = this.ValWSlabelUser.Text;
                tmpValWs.WebService_Password    = this.ValWSlabelPwd.Text;
                tmpValWs.WebService_Crypted     = false;

                _tmp_settings.OBS_default_valueDomainID         = this.OBS_VALUEtextBox.Text;
                _tmp_settings.TIME_PERIOD_default_valueDomainID = this.TIME_PERIODTextBox.Text;

                if (String.IsNullOrEmpty(tmpValWs.WebService_public_URL.Replace("-", "")) || String.IsNullOrEmpty(tmpValWs.WebService_Name.Replace("-", "")))
                {
                    if (MessageBox.Show("Validation web service has not been set. If you continue you will not able to validate and translate your VTL statements. Do you want to proceed without it? ", "Validatrion ws", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return;
                    }
                }

                _tmp_settings.ValidationWebService = tmpValWs;


                _tmp_settings.ReplaceSettings();

                this.DialogResult = DialogResult.OK;

                this.Close();
            }
            catch (Exception ex)
            {
                this.DialogResult = DialogResult.Cancel;
                CommonItem.ErrManger.ErrorManagement(ex, false, this);
            }
        }
コード例 #4
0
        //public WebServiceLayer(ApplicationSettings CurrentSettings)
        //{
        //    try
        //    {
        //        _settings = WsConfigurationSettings.GetSection(ConfigurationUserLevel.PerUserRoamingAndLocal);
        //        _settings.EndPoint = CurrentSettings.getWebserviceInfoByID(CurrentSettings.SelectedWebServiceID).WebService_clear_URL;
        //        _settings.WSDL = _settings.EndPoint + "?WSDL";
        //        _settings.EnableProxy = CurrentSettings.EnableProxy;
        //        _settings.ProxyServer = CurrentSettings.ProxyServer;
        //        _settings.ProxyServerPort = CurrentSettings.ProxyPort;
        //        _settings.ProxyUsername = CurrentSettings.ProxyUser;
        //        _settings.ProxyPassword = CurrentSettings.ProxyPwd;

        //        _settings.Password = CurrentSettings.getWebserviceInfoByID(CurrentSettings.SelectedWebServiceID).WebService_Password;
        //        _settings.Username = CurrentSettings.getWebserviceInfoByID(CurrentSettings.SelectedWebServiceID).WebService_UserName;

        //        _webServiceInfo = CurrentSettings.getWebserviceInfoByID(CurrentSettings.SelectedWebServiceID);
        //     }
        //    catch (Exception ex)
        //    {
        //        throw new Exception("Error, [WebServiceLayer.classes.service.Net.WebServiceLayer.WebServiceLayer] " + ex.Message);
        //    }
        //}

        public WebServiceLayer(ApplicationSettings.classes.services.ApplicationSettings CurrentSettings, int WebServiceID)
        {
            try
            {
                _settings                 = WsConfigurationSettings.GetSection(ConfigurationUserLevel.PerUserRoamingAndLocal);
                _settings.EndPoint        = CurrentSettings.getWebserviceInfoByID(WebServiceID).WebService_clear_URL;
                _settings.WSDL            = _settings.EndPoint + "?WSDL";
                _settings.EnableProxy     = CurrentSettings.EnableProxy;
                _settings.ProxyServer     = CurrentSettings.ProxyServer;
                _settings.ProxyServerPort = CurrentSettings.ProxyPort;
                _settings.ProxyUsername   = CurrentSettings.ProxyUser;
                _settings.ProxyPassword   = CurrentSettings.ProxyPwd;

                _settings.Password = CurrentSettings.getWebserviceInfoByID(WebServiceID).WebService_Password;
                _settings.Username = CurrentSettings.getWebserviceInfoByID(WebServiceID).WebService_UserName;

                _webServiceInfo = CurrentSettings.getWebserviceInfoByID(WebServiceID);
            }
            catch (Exception ex)
            {
                throw new Exception("Error, [WebServiceLayer.classes.service.Net.WebServiceLayer.WebServiceLayer] " + ex.Message);
            }
        }
コード例 #5
0
        private void LoadingStuff()
        {
            try
            {
                CommonItem.CurrentSettings = new MainApplicationSettings();
                CommonItem.ErrManger       = new classes.tool.ErrorAndLogManager();
                List <CommonConst.Loading_Status> settingResult = CommonItem.CurrentSettings.LoadSettings(true);

                if (settingResult[0] == CommonConst.Loading_Status.NOT_FOUND)
                {
                    _errorMessage.Add(" - Settings not found, please create them through the Settings module and restart the application! \n \n" + settingResult[0].ToString());
                    _error = true;
                    return;
                }

                //LoadSettings test
                //-----------------------------------------------------------------------------
                System.Threading.Thread.Sleep(_millisecondDelay);
                backgroundLoader.ReportProgress(1);
                if (settingResult[0] != CommonConst.Loading_Status.LOADED)
                {
                    string resultList = "";
                    foreach (CommonConst.Loading_Status sr in settingResult)
                    {
                        resultList += sr + "  ";
                    }
                    _errorMessage.Add("Some settings are missed or not correct. They can cause malfunctions. \r\n Please fix them through the Settings module and restart the application! [" + resultList + "]");
                    _error = true;
                }

                //Interaction Url test
                //-----------------------------------------------------------------------------
                System.Threading.Thread.Sleep(_millisecondDelay);
                backgroundLoader.ReportProgress(2);
                if (CommonItem.CurrentSettings.InteractionWebService != null)
                {
                    if (settingResult.Where(err => err == CommonConst.Loading_Status.INTERACTION_WS_LOADED).Count() > 0)
                    {
                        if (!RemoteFileExists.Check(CommonItem.CurrentSettings.InteractionWebService.WebService_clear_URL, true))
                        {
                            _errorMessage.Add(" - Connection to Interaction web service failed.");
                            _error = true;
                        }
                        else
                        {
                            //Interaction DB test
                            //-----------------------------------------------------------------------------
                            VTLInt_Service.ServiceClient VTL_service = VTLInt_ServiceManager.GetClient(CommonItem.CurrentSettings.InteractionWebService);

                            System.Threading.Thread.Sleep(_millisecondDelay);
                            backgroundLoader.ReportProgress(3);
                            if (!VTL_service.TestDatabaseConnection())
                            {
                                _errorMessage.Add(" - VTL Database connection from Interaction web service failed.");
                                _error = true;
                            }
                        }
                    }
                }
                //Validation Url test
                //-----------------------------------------------------------------------------
                System.Threading.Thread.Sleep(_millisecondDelay);
                backgroundLoader.ReportProgress(4);
                WebServiceConnector.RestWebConnector RestWS = new WebServiceConnector.RestWebConnector(CommonItem.CurrentSettings.ValidationWebService.WebService_public_URL + CommonItem.SYNTACTIC_VALIDATION_WEBMETHOD);
                Dictionary <string, string>          args   = new Dictionary <string, string>();

                try
                {
                    string result = RestWS.SendPostRequest("ds1:=length(1);");
                }
                catch (Exception ex)
                {
                    _errorMessage.Add(" - Connection to Validation web service failed. [" + ex.Message + "]");
                    _error = true;
                }

                //-----------------------------------------------------------------------------

                //Metadata Url test
                //-----------------------------------------------------------------------------
                System.Threading.Thread.Sleep(_millisecondDelay);
                backgroundLoader.ReportProgress(5);
                if (CommonItem.CurrentSettings.WebServices.Count > 0)
                {
                    ApplicationSettings.classes.services.ApplicationSettings.WebServiceInfo ws = CommonItem.CurrentSettings.WebServices[0];
                    if (!RemoteFileExists.Check(ws.WebService_clear_URL, true))
                    {
                        _errorMessage.Add(" - Connection to SDMX Metadata web service failed.");
                        _error = true;
                    }
                }
                //-----------------------------------------------------------------------------
            }
            catch (Exception ex)
            {
                _error = true;
                if (_errorMessage.Count() == 0)
                {
                    _errorMessage.Add(" - " + ex.Message);
                }
            }
        }