Beispiel #1
0
        public IResponse Execute(IRequest request)
        {
            HttpWebRequest httpWebRequest = request.GetHttpWebRequest();
            WebResponse    webResponse    = null;

            bool isIEProxyUsed = false;

            if (ConfigurationManager.AppSettings["isIEProxyUsed"] != null)
            {
                try
                {
                    isIEProxyUsed = Boolean.Parse(ConfigurationManager.AppSettings["isIEProxyUsed"]);
                }
                catch (Exception)
                {
                }
            }
            try
            {
                if (isIEProxyUsed)
                {
                    httpWebRequest.Proxy = WebRequest.GetSystemWebProxy();
                }
                webResponse = httpWebRequest.GetResponse();
            }
            catch (WebException webException)
            {
                log.Info("Error received while executing a request", webException);
                webResponse = webException.Response;
            }

            return(deserializer.Deserialize(request.GetType(), (HttpWebResponse)webResponse));
        }
 private void TheApplicationDeserializesThePlaySongResponse()
 {
     try
     {
         playSongResponse = (PlaySongResponse)deserializer.Deserialize(typeof(PlayMixRequest), responseString);
     }
     catch (Exception ex)
     {
         exception = ex;
     }
 }