Beispiel #1
0
        public RefData GetByCusip(string url, string cusip)
        {
            Console.WriteLine("Reached HttpRefDataService GetByCusip with url: " + url);

            return(MockRefDataRepository.GetByCusip(cusip));

            //CreateRequest(url, cusip);

            //WebResponse response = request.GetResponse();

            //if (response != null)
            //{
            //    Console.WriteLine("HttpRefDataService got a response");
            //}

            //this.Status = ((HttpWebResponse)response).StatusDescription;

            //dataStream = response.GetResponseStream();

            //var ser = new DataContractJsonSerializer(typeof(RefData));

            //RefData refDataObject;
            //refDataObject = (RefData)ser.ReadObject(dataStream);


            ////     StreamReader sr = new StreamReader(dataStream);
            ////     string refDataResponse = sr.ReadToEnd();

            ////     sr.Close();
            //dataStream.Close();
            //response.Close();

            ////     return refDataResponse;
            //return refDataObject;
        }
Beispiel #2
0
        public OperationResult GetByCusip(string cusip)
        {
            try
            {
                Console.WriteLine("Reached MockRefDataServiceHandler GetByCusip");
                return(new OperationResult.OK {
                    ResponseResource = MockRefDataRepository.GetByCusip(cusip)
                });
            }

            catch (KeyNotFoundException ex)
            {
                return(new OperationResult.BadRequest {
                    ResponseResource = ex.StackTrace
                });
            }
        }