/// <summary> /// Validates this instance. /// </summary> /// <returns>true if the task is valid.</returns> public override bool Validate() { if (_ReportServers.Count == 0) { Logger.LogException("PublishBinaryFilesTask::Validate", "No report server specified."); return(false); } foreach (ReportServerInfo reportServer in _ReportServers.Values) { Logger.LogMessage(string.Format("Validating reporting service: {0}", reportServer.ServiceBaseUrl)); IWSWrapper wrapper; Exception exception; if (WSWrapper2003.TryCreate(reportServer, out wrapper, out exception) || WSWrapper2005.TryCreate(reportServer, out wrapper, out exception)) { _WSWrappers.Add(reportServer.Name, wrapper); } else { Logger.LogException("PublishBinaryFilesTask::Validate", exception.Message); return(false); } } return(true); }
public static bool TryCreate(ReportServerInfo reportServer, out IWSWrapper result, out Exception exception) { ReportingService2005 proxy = new ReportingService2005() { Url = reportServer.GetServiceUrl(SERVICE_NAME), Timeout = reportServer.Timeout ?? -1, Credentials = reportServer.CreateCredentials(SERVICE_NAME) }; try { proxy.ListSecureMethods(); result = new WSWrapper2005(proxy); exception = null; return(true); } catch (Exception e) { proxy.Dispose(); result = null; exception = e; return(false); } }