From 84e5e867517f238bf658ae1f298e56a4c6d31529 Mon Sep 17 00:00:00 2001 From: RKrom Date: Tue, 20 Nov 2012 15:54:39 +0000 Subject: [PATCH] Fixed issue when the WSDL isn't in the URL git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2298 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4 --- GreenshotJiraPlugin/Jira.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/GreenshotJiraPlugin/Jira.cs b/GreenshotJiraPlugin/Jira.cs index ed966020f..555a138bc 100644 --- a/GreenshotJiraPlugin/Jira.cs +++ b/GreenshotJiraPlugin/Jira.cs @@ -109,6 +109,7 @@ namespace Jira { private string url; private Cache jiraCache = new Cache(60 * config.Timeout); private Cache userCache = new Cache(60 * config.Timeout); + private bool suppressBackgroundForm = false; public JiraConnector() : this(false) { } @@ -116,6 +117,11 @@ namespace Jira { public JiraConnector(bool suppressBackgroundForm) { this.url = config.Url; this.timeout = config.Timeout; + this.suppressBackgroundForm = suppressBackgroundForm; + createService(); + } + + private void createService() { if (!suppressBackgroundForm) { new PleaseWaitForm().ShowAndWait(JiraPlugin.Instance.JiraPluginAttributes.Name, Language.GetString("jira", LangKey.communication_wait), delegate() { @@ -127,6 +133,9 @@ namespace Jira { } jira.Url = url; jira.Proxy = NetworkHelper.CreateProxy(new Uri(url)); + // Do not use: + //jira.AllowAutoRedirect = true; + jira.UserAgent = "Greenshot"; } ~JiraConnector() { @@ -145,10 +154,13 @@ namespace Jira { try { this.credentials = jira.login(user, password); } catch(Exception ex) { - if (!config.Url.EndsWith("wsdl")) { - config.Url = config.Url + "/rpc/soap/jirasoapservice-v2?wsdl"; - jira = new JiraSoapServiceService(); + if (!url.EndsWith("wsdl")) { + url = url + "/rpc/soap/jirasoapservice-v2?wsdl"; + // recreate the service with the new url + createService(); this.credentials = jira.login(user, password); + // Worked, store the url in the configuration + config.Url = url; IniConfig.Save(); } else { throw ex;