public FindServicesResponseObj FindServices([FromBody] FindServicesRequestObj findServicesObj)
        {
            log.Info("Incoming request to " + GetCurrentMethod());

            var requestString = JsonConvert.SerializeObject(findServicesObj, Formatting.Indented);

            _logEventService.LogInfo(EventNumber.SPIS_consumeService, EventDataType.None, null, requestString);

            try
            {
                var result = _sscService.FindServices(findServicesObj);

                _logEventService.LogSuccess(EventNumber.SPIS_consumeService, EventDataType.Other, null, JsonConvert.SerializeObject(result, Formatting.Indented));
                return(result);
            }
            catch (HttpResponseException ex)
            {
                _logEventService.LogError(EventNumber.SPIS_consumeService, EventType.Error_internal, null,
                                          JsonConvert.SerializeObject(requestString, Formatting.Indented) + " " + ex.Response.ToString());

                throw;
            }
            catch (Exception ex)
            {
                log.Error(ex.Message, ex);

                string msg = "SPIS internal server error. " + ex.Message;
                _logEventService.LogError(EventNumber.SPIS_consumeService, EventType.Error_internal, null,
                                          JsonConvert.SerializeObject(requestString, Formatting.Indented) + " " + ex.Message);

                throw CreateHttpResponseException(HttpStatusCode.InternalServerError, msg);
            }
        }
示例#2
0
        public FindServicesResponseObj FindServices([FromBody] FindServicesRequestObj findServicesObj)
        {
            log.Info("Incoming request to " + GetCurrentMethod());

            _logEventService.LogInfo(EventNumber.VIS_consumeService, EventDataType.Other, null,
                                     JsonConvert.SerializeObject(findServicesObj, Formatting.Indented));
            try
            {
                var result = _sscService.FindServices(findServicesObj);

                _logEventService.LogSuccess(EventNumber.VIS_consumeService, EventDataType.Other, null,
                                            JsonConvert.SerializeObject(result, Formatting.Indented));

                //set last interaction time
                var conInfo = _connectionInformationService.Get().FirstOrDefault();
                if (conInfo == null)
                {
                    _connectionInformationService.Insert(new ConnectionInformation {
                        LastInteraction = DateTime.UtcNow
                    });
                }
                else
                {
                    conInfo.LastInteraction = DateTime.UtcNow;
                    _connectionInformationService.Update(conInfo);
                }
                _context.SaveChanges();

                return(result);
            }
            catch (HttpResponseException ex)
            {
                _logEventService.LogError(EventNumber.VIS_consumeService, EventType.Error_internal, null,
                                          JsonConvert.SerializeObject(ex.Response, Formatting.Indented));

                throw;
            }
            catch (Exception ex)
            {
                log.Error(ex.Message, ex);

                string msg = "VIS internal server error. " + ex.Message;
                _logEventService.LogError(EventNumber.VIS_consumeService, EventType.Error_internal, null, ex.Message);

                throw CreateHttpResponseException(HttpStatusCode.InternalServerError, msg);
            }
        }