void UpdateService(WebServiceDiscoveryResult service, string url) { StringBuilder text = new StringBuilder(); if (service == null) { this.IsWebService = false; this.selectedService = null; } else { // Set the Default Namespace and Reference this.tbxNamespace.Text = this.DefaultNamespace; if (project != null) { string name = this.DefaultReferenceName; var items = WebReferencesService.GetWebReferenceItems(project); if (items.Any(it => it.Name == name)) { int num = 2; while (items.Any(it => it.Name == name + "_" + num)) { num++; } name = name + "_" + num; } this.tbxReferenceName.Text = name; } this.IsWebService = true; this.selectedService = service; if (docLabel != null) { docLabel.Wrap = false; text.Append(service.GetDescriptionMarkup()); } } if (docLabel != null) { docLabel.Wrap = false; if (text.Length >= 0) { docLabel.Markup = text.ToString(); } else { docLabel.Markup = GettextCatalog.GetString("Web service not found."); } } return; }
/// <summary>Queries the web service to validate that the current url contains services</summary> /// <param name="param">An object that contains the parameter being passed from the ThreadPool.</param> private void QueryService(object param) { string url = param as string; // Set the service url lock (this) { if (serviceUrl == url) { return; } serviceUrl = url; } WebServiceEngine serviceEngine; if (comboModel.Active == 0) { serviceEngine = WebReferencesService.WcfEngine; } else { serviceEngine = WebReferencesService.WsEngine; } WebServiceDiscoveryResult service = null; // Checks the availablity of any services try { service = serviceEngine.Discover(url); } catch (Exception ex) { serviceUrl = null; this.IsWebService = false; this.selectedService = null; LoggingService.LogError("Error while discovering web services", ex); ShowError(ex.Message); return; } Application.Invoke(delegate { UpdateService(service, url); }); }