public bool Send(Message ack, TDSQASystemAPI.Data.XmlRepositoryItem item)
        {
            if (String.IsNullOrEmpty(item.CallbackURL))
            {
                return(false);
            }

            try
            {
                string ser = Serialization.SerializeJson <Message>(ack);
                using (HttpClient client = new HttpClient())
                {
                    using (StringContent content = new StringContent(ser, Encoding.UTF8, "application/json"))
                    {
                        HttpResponseMessage response = client.PostAsync(item.CallbackURL, content).Result;
                        if (response.StatusCode != System.Net.HttpStatusCode.OK)
                        {
                            throw new QAException(String.Format("Error posting acknowlegement for opp: {0} to {1}.  Status Code: {2}, Result: {3}", ack.oppKey, item.CallbackURL, response.StatusCode, response.Content.ReadAsStringAsync().Result), QAException.ExceptionType.General);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new QAException(String.Format("Error sending acknowledgement: {0}", ex.Message), QAException.ExceptionType.General, ex);
            }

            return(true);
        }
Exemplo n.º 2
0
 public IAcknowledgementTarget SelectTarget(TDSQASystemAPI.Data.XmlRepositoryItem xmlRepoItem)
 {
     // only REST is supported in OSS TIS
     return(new RESTAcknowledgementTarget());
 }