public string getSoapToken(JiraServer server)
 {
     try {
         using (SoapSession session = createSoapSession(server)) {
             return(session.login(server.UserName, server.Password));
         }
     } catch (Exception e) {
         Debug.WriteLine("JiraServerFacade.getSoapToken() - exception: " + e.Message);
     }
     return(null);
 }
 private void setSessionToken(JiraServer server, SoapSession session)
 {
     lock (tokenMap) {
         string tokenKey = getTokenKey(server);
         if (tokenMap.ContainsKey(tokenKey))
         {
             session.Token = tokenMap[tokenKey];
         }
         else
         {
             tokenMap[tokenKey] = session.login(server.UserName, server.Password);
         }
     }
 }
 private void wrapExceptionsVoid(JiraServer server, SoapSession session, WrappedVoid wrapped)
 {
     try {
         setSessionToken(server, session);
         wrapped();
     } catch (System.Web.Services.Protocols.SoapException) {
         // let's retry _just once_ - PLVS-27
         removeSessionToken(server);
         try {
             setSessionToken(server, session);
             wrapped();
         } catch (Exception e) {
             removeSessionToken(server);
             maybeHandle503(e);
             throw;
         }
     } catch (Exception e) {
         removeSessionToken(server);
         maybeHandle503(e);
         throw;
     }
 }
        private static SoapSession createSoapSession(JiraServer server)
        {
            SoapSession s = new SoapSession(server.Url);

            return(s);
        }
 public void uploadAttachment(JiraIssue issue, string name, byte[] attachment)
 {
     using (SoapSession s = createSoapSession(issue.Server)) {
         wrapExceptionsVoid(issue.Server, s, () => s.uploadAttachment(issue.Key, name, attachment));
     }
 }
 public void updateIssue(JiraIssue issue, ICollection <JiraField> fields)
 {
     using (SoapSession s = createSoapSession(issue.Server)) {
         wrapExceptionsVoid(issue.Server, s, () => s.updateIssue(issue.Key, fields));
     }
 }
 public void addComment(JiraIssue issue, string comment)
 {
     using (SoapSession s = createSoapSession(issue.Server)) {
         wrapExceptionsVoid(issue.Server, s, () => s.addComment(issue, comment));
     }
 }
 public List <JiraNamedEntity> getIssueTypes(JiraServer server)
 {
     using (SoapSession s = createSoapSession(server)) {
         return(wrapExceptions(server, s, () => s.getIssueTypes()));
     }
 }
 public JiraNamedEntity getSecurityLevel(JiraIssue issue)
 {
     using (SoapSession s = createSoapSession(issue.Server)) {
         return(wrapExceptions(issue.Server, s, () => s.getSecurityLevel(issue.Key)));
     }
 }
 public object getIssueSoapObject(JiraIssue issue)
 {
     using (SoapSession s = createSoapSession(issue.Server)) {
         return(wrapExceptions(issue.Server, s, () => s.getIssueSoapObject(issue.Key)));
     }
 }
 public string createIssue(JiraServer server, JiraIssue issue)
 {
     using (SoapSession s = createSoapSession(server)) {
         return(wrapExceptions(server, s, () => s.createIssue(issue)));
     }
 }
 public void runIssueActionWithParams(JiraIssue issue, JiraNamedEntity action, ICollection <JiraField> fields, string comment)
 {
     using (SoapSession s = createSoapSession(issue.Server)) {
         wrapExceptionsVoid(issue.Server, s, () => s.runIssueActionWithParams(issue, action.Id, fields, comment));
     }
 }
 public void runIssueActionWithoutParams(JiraIssue issue, JiraNamedEntity action)
 {
     using (SoapSession s = createSoapSession(issue.Server)) {
         wrapExceptionsVoid(issue.Server, s, () => s.runIssueActionWithoutParams(issue, action.Id));
     }
 }
 public List <JiraField> getFieldsForAction(JiraIssue issue, int actionId)
 {
     using (SoapSession s = createSoapSession(issue.Server)) {
         return(wrapExceptions(issue.Server, s, () => s.getFieldsForAction(issue, actionId)));
     }
 }
 public List <JiraNamedEntity> getActionsForIssue(JiraIssue issue)
 {
     using (SoapSession s = createSoapSession(issue.Server)) {
         return(wrapExceptions(issue.Server, s, () => s.getActionsForIssue(issue)));
     }
 }
 public void logWorkAndLeaveRemainingUnchanged(JiraIssue issue, string timeSpent, DateTime startDate, string comment)
 {
     using (SoapSession s = createSoapSession(issue.Server)) {
         wrapExceptionsVoid(issue.Server, s, () => s.logWorkAndLeaveRemainingUnchanged(issue.Key, timeSpent, startDate, comment));
     }
 }
 public List <JiraProject> getProjects(JiraServer server)
 {
     using (SoapSession s = createSoapSession(server)) {
         return(wrapExceptions(server, s, () => s.getProjects()));
     }
 }
 public void logWorkAndUpdateRemainingManually(JiraIssue issue, string timeSpent, DateTime startDate, string remainingEstimate, string comment)
 {
     using (SoapSession s = createSoapSession(issue.Server)) {
         wrapExceptionsVoid(issue.Server, s, () => s.logWorkAndUpdateRemainingManually(issue.Key, timeSpent, startDate, remainingEstimate, comment));
     }
 }
 public List <JiraNamedEntity> getSubtaskIssueTypes(JiraServer server, JiraProject project)
 {
     using (SoapSession s = createSoapSession(server)) {
         return(wrapExceptions(server, s, () => s.getSubtaskIssueTypes(project)));
     }
 }
 public List <JiraSavedFilter> getSavedFilters(JiraServer server)
 {
     using (SoapSession s = createSoapSession(server)) {
         return(wrapExceptions(server, s, () => s.getSavedFilters()));
     }
 }