Beispiel #1
0
        /// <summary>
        /// Create the error response for the batch request.
        /// </summary>
        /// <param name="responseType">Type of the response.</param>
        /// <param name="locations">Geo-locations details of the batch request.</param>
        /// <param name="errorMessages">The error messages.</param>
        /// <returns>PawsResponse object.</returns>
        public static PawsResponse CreateErrorResponse(string responseType, GeoLocation[] locations, params string[] errorMessages)
        {
            PawsResponse response = CreateErrorResponse(responseType, errorMessages);

            // TODO: Take a necessary action based on "locations" parameter values.

            //// Eg: If error occurred because of "OUTSIDE_COVERAGE", then initialize DbUpdateSpec element that provides a list of alternative databases that
            //// might be appropriate for the requested location.

            return(response);
        }
Beispiel #2
0
        /// <summary>
        /// Master Device query for batch available spectrum
        /// </summary>
        /// <param name="parameters">parameters coming from master device</param>
        /// <returns>Returns the paws response.</returns>
        public PawsResponse AvailableSpectrumBatch(Parameters parameters)
        {
            const string LogMethodName = "PawsManager.AvailableSpectrumBatch(Parameters parameters)";

            this.PawsLogger.Log(TraceEventType.Information, LoggingMessageId.PAWSGenericMessage, "Enter " + LogMethodName);
            Check.IsNotNull <ParametersBase>(parameters, Constants.ParameterNameParameters);

            PawsResponse resultResponse = null;

            try
            {
                string requestVersion = parameters.Version;

                if (requestVersion != this.version)
                {
                    return(ErrorHelper.CreateErrorResponse(Constants.TypeBatchAvailableSpectrumResponse, Constants.ErrorMessageDatabaseUnsupported));
                }

                BatchAvailableSpectrumRequestBase spectrumRequest = parameters.GetBatchAvailableSpectrumRequest();
                List <string> errorMessages;
                if (!this.PawsValidator.ValidateBatchSpectrumQueryRequest(spectrumRequest, out errorMessages))
                {
                    return(ErrorHelper.CreateErrorResponse(Constants.TypeBatchAvailableSpectrumResponse, errorMessages.ToArray()));
                }

                var spectrumSchedules = this.PawsDriver.GetAvailableSpectrumBatch(spectrumRequest);

                resultResponse = new PawsResponse
                {
                    JsonRpc = "2.0",
                    Result  = new Result
                    {
                        Type             = Constants.TypeBatchAvailableSpectrumResponse,
                        Version          = this.version,
                        TimeStamp        = DateTime.UtcNow.ToString("u"),
                        DeviceDescriptor = spectrumRequest.DeviceDescriptor,
                        GeoSpectrumSpecs = spectrumSchedules
                    }
                };
            }
            catch (Exception ex)
            {
                // Log failed transaction
                this.PawsLogger.Log(TraceEventType.Error, LoggingMessageId.PAWSGenericMessage, ex.ToString());
                resultResponse = ErrorHelper.CreateExceptionResponse(Constants.TypeBatchAvailableSpectrumResponse, ex.ToString());
            }

            this.PawsLogger.Log(TraceEventType.Information, LoggingMessageId.PAWSGenericMessage, "Exit " + LogMethodName);

            return(resultResponse);
        }
Beispiel #3
0
        public void SubmitPawsInterference(IRequestParameters requestParams)
        {
            Request request = new Request
            {
                Method  = Microsoft.Whitespace.Entities.Constants.MethodNameInterferenceQuery,
                Id      = "1",
                JsonRpc = "2.0",
                Params  = requestParams.Params
            };

            PawsResponse response = this.httpManager.Post <PawsResponse>(request, requestParams.RegionName, null);

            var error = response.Error;

            if (error == null)
            {
                throw new ResponseErrorException(error.Type, error.Data, error.Code, error.Message);
            }
        }
        public override void OnActionExecuting(HttpActionContext actionContext)
        {
            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();

            var  request          = actionContext.ActionArguments[RequestArgumentName];
            bool enableValidation = false;

            if (Utils.Configuration.HasSetting(Constants.ValidateWSDLocation))
            {
                enableValidation = Utils.Configuration[Constants.ValidateWSDLocation].ToBool();
            }

            if (request == null || !enableValidation)
            {
                return;
            }

            HttpRequestMessage httpRequest  = (HttpRequestMessage)request;
            Request            requestparam = new Request();

            this.PawsAuditor.UserId        = this.PawsLogger.UserId;
            this.PawsAuditor.TransactionId = this.PawsLogger.TransactionId;
            this.PawsAuditor.RegionCode    = Utils.Configuration.CurrentRegionId;

            try
            {
                requestparam = JsonSerialization.DeserializeString <Request>(httpRequest.Content.ReadAsStringAsync().Result);
                GeoLocation   geolocation  = requestparam.Params.Location;
                GeoLocation[] geolocations = requestparam.Params.Locations;

                List <RegionPolygonsCache> subregions = (List <RegionPolygonsCache>)DatabaseCache.ServiceCacheHelper.GetServiceCacheObjects(ServiceCacheObjectType.RegionPolygons, null);

                bool isValidRequest = false;
                bool isBatchRequest = false;

                if (geolocation != null)
                {
                    isValidRequest = ValidateRequestedLocation(geolocation, subregions);
                }
                else if (geolocations != null && geolocations.Length > 0)
                {
                    isBatchRequest = true;
                    isValidRequest = ValidateBatchRequestLocations(geolocations, subregions);
                }

                stopWatch.Stop();

                if (!isValidRequest)
                {
                    PawsResponse errorResponse = null;

                    if (isBatchRequest)
                    {
                        errorResponse = ErrorHelper.CreateErrorResponse(requestparam.Method, geolocations, Constants.ErrorMessageOutsideCoverage);
                    }
                    else
                    {
                        errorResponse = ErrorHelper.CreateErrorResponse(requestparam.Method, geolocation, Constants.ErrorMessageOutsideCoverage);
                    }

                    this.PawsLogger.Log(TraceEventType.Error, LoggingMessageId.PAWSGenericMessage, errorResponse.Error.Message);

                    string  auditMethod;
                    AuditId auditId = PawsUtil.GetAuditId(requestparam.Method, out auditMethod);

                    this.PawsAuditor.Audit(auditId, AuditStatus.Failure, stopWatch.ElapsedMilliseconds, auditMethod + " failed");

                    actionContext.Response = actionContext.Request.CreateResponse <PawsResponse>(errorResponse);
                }
            }
            catch (Exception ex)
            {
                stopWatch.Stop();

                this.PawsLogger.Log(TraceEventType.Error, LoggingMessageId.PAWSGenericMessage, ex.ToString());

                string  auditMethod;
                AuditId auditId = PawsUtil.GetAuditId(requestparam.Method, out auditMethod);

                this.PawsAuditor.Audit(auditId, AuditStatus.Failure, stopWatch.ElapsedMilliseconds, auditMethod + " failed");

                PawsResponse errorResponse = ErrorHelper.CreateExceptionResponse(requestparam.Method, ex.Message);

                actionContext.Response = actionContext.Request.CreateResponse <PawsResponse>(errorResponse);
            }
        }
Beispiel #5
0
        /// <summary>
        /// Initializes Master Device
        /// </summary>
        /// <param name="parameters">parameters coming from master device</param>
        /// <returns>Returns the paws response.</returns>
        public PawsResponse Initialize(Parameters parameters)
        {
            const string LogMethodName = "PawsManager.Initialize(Parameters parameters)";

            //// Begin Log transaction
            this.PawsLogger.Log(TraceEventType.Information, LoggingMessageId.PAWSGenericMessage, "Enter " + LogMethodName);

            try
            {
                Check.IsNotNull <ParametersBase>(parameters, Constants.ParameterNameParameters);
                InitRequestBase initRequest = parameters.GetInitRequest();

                List <string> errorMessages = null;
                if (!this.PawsValidator.ValidateInitializationRequest(initRequest, out errorMessages))
                {
                    return(ErrorHelper.CreateErrorResponse(Constants.TypeInitResponse, errorMessages.ToArray()));
                }

                string requestVersion = parameters.Version;
                if (requestVersion != this.version)
                {
                    return(ErrorHelper.CreateErrorResponse(Constants.TypeInitResponse, Constants.ErrorMessageDatabaseUnsupported));
                }

                // Route to Initialize method in WhiteSpace Driver
                int resp = this.PawsDriver.Initialize(initRequest);

                PawsResponse initResponse = null;
                switch (resp)
                {
                case 0:
                {
                    initResponse = new PawsResponse()
                    {
                        JsonRpc = "2.0",
                        Result  = new Result
                        {
                            Type        = Constants.TypeInitResponse,
                            Version     = this.version,
                            RulesetInfo = this.PawsDriver.GetRuleSetInfo(initRequest.DeviceDescriptor)
                        }
                    };
                    break;
                }

                case -302:
                    return(ErrorHelper.CreateErrorResponse(Constants.TypeInitResponse, Constants.ErrorMessageNotRegistered));

                default:
                    return(ErrorHelper.CreateErrorResponse(Constants.TypeInitResponse, Constants.ErrorMessageServerError));
                }

                // End Log transaction
                this.PawsLogger.Log(TraceEventType.Information, LoggingMessageId.PAWSGenericMessage, "Exit " + LogMethodName);

                // Return Response
                return(initResponse);
            }
            catch (Exception ex)
            {
                // Log failed transaction
                this.PawsLogger.Log(TraceEventType.Error, LoggingMessageId.PAWSGenericMessage, ex.ToString());
                var initResponse = ErrorHelper.CreateExceptionResponse(Constants.TypeInitResponse, ex.ToString());
                return(initResponse);
            }
        }
Beispiel #6
0
        /// <summary>
        /// Interference Query of Master Device
        /// </summary>
        /// <param name="parameters">parameters coming from master device</param>
        /// <returns>Returns the paws response.</returns>
        public PawsResponse InterferenceQuery(Parameters parameters)
        {
            try
            {
                const string LogMethodName = "PawsManager.InterferenceQuery(Parameters parameters)";

                // Begin Log transaction
                this.PawsLogger.Log(TraceEventType.Information, LoggingMessageId.PAWSGenericMessage, "Enter " + LogMethodName);
                Check.IsNotNull <ParametersBase>(parameters, Constants.ParameterNameParameters);
                string requestVersion = parameters.Version;
                if (requestVersion != this.version)
                {
                    return(ErrorHelper.CreateErrorResponse(Constants.TypeInterferenceQueryResponse, Constants.ErrorMessageDatabaseUnsupported));
                }

                InterferenceQueryRequestBase interferenceRequest = parameters.GetInterferenceQueryRequest();
                List <string> errorMessages;
                if (!this.PawsValidator.ValidateInterferenceQueryRequest(interferenceRequest, out errorMessages))
                {
                    return(ErrorHelper.CreateErrorResponse(Constants.TypeInterferenceQueryResponse, errorMessages.ToArray()));
                }

                // Route to Interference Query method in WhiteSpace Driver
                int          resp     = this.PawsDriver.InterferenceQuery(interferenceRequest);
                PawsResponse response = null;
                if (resp == 0)
                {
                    response = new PawsResponse
                    {
                        JsonRpc = "2.0",
                        Result  = new Result
                        {
                            Type    = Constants.TypeInterferenceQueryResponse,
                            Version = this.version,
                        }
                    };
                }
                else if (resp == 200)
                {
                    response = new PawsResponse
                    {
                        JsonRpc = "2.0",
                        Error   = new Result
                        {
                            Code    = resp.ToString(),
                            Message = Constants.IncumbentNotFound
                        }
                    };
                }
                else
                {
                    response = ErrorHelper.CreateErrorResponse(Constants.TypeInterferenceQueryResponse, Constants.ErrorMessageServerError);
                }

                // End Log transaction
                this.PawsLogger.Log(TraceEventType.Information, LoggingMessageId.PAWSGenericMessage, "Exit " + LogMethodName);

                // Return Response
                return(response);
            }
            catch (Exception ex)
            {
                // Log failed transaction
                this.PawsLogger.Log(TraceEventType.Error, LoggingMessageId.PAWSGenericMessage, ex.ToString());
                PawsResponse resp = ErrorHelper.CreateExceptionResponse(Constants.TypeInterferenceQueryResponse, ex.ToString());
                return(resp);
            }
        }
Beispiel #7
0
        /// <summary>
        /// Mater device notify about spectrum usage
        /// </summary>
        /// <param name="parameters">parameters coming from master device</param>
        /// <returns>Returns the paws response.</returns>
        public PawsResponse NotifySpectrumUsage(Parameters parameters)
        {
            try
            {
                const string LogMethodName = "PawsManager.NotifySpectrumUsage(Parameters parameters)";

                // Begin Log transaction
                this.PawsLogger.Log(TraceEventType.Information, LoggingMessageId.PAWSGenericMessage, "Enter " + LogMethodName);
                Check.IsNotNull <ParametersBase>(parameters, Constants.ParameterNameParameters);

                string requestVersion = parameters.Version;

                if (requestVersion != this.version)
                {
                    return(ErrorHelper.CreateErrorResponse(Constants.TypeNotifySpectrumUsageResponse, Constants.ErrorMessageDatabaseUnsupported));
                }

                NotifyRequestBase notifyRequest = parameters.GetNotifyRequest();
                List <string>     errorMessages;

                if (!this.PawsValidator.ValidateNotifyRequest(notifyRequest, out errorMessages))
                {
                    return(ErrorHelper.CreateErrorResponse(Constants.TypeNotifySpectrumUsageResponse, errorMessages.ToArray()));
                }

                int    resp         = 0;
                string errorMessage = string.Empty;
                // Route to Notify Use Spectrum method in WhiteSpace Driver
                resp = this.PawsDriver.NotifySpectrumUsage(notifyRequest, out errorMessage);


                PawsResponse response = null;

                if (resp == 0)
                {
                    response = new PawsResponse
                    {
                        JsonRpc = "2.0",
                        Result  = new Result
                        {
                            Type    = Constants.TypeNotifySpectrumUsageResponse,
                            Version = this.version,
                        }
                    };
                }
                else if (resp == -202)
                {
                    response            = ErrorHelper.CreateErrorResponse(Constants.TypeNotifySpectrumUsageResponse, Constants.ErrorMessageServerError);
                    response.Error.Data = errorMessage;
                }
                else
                {
                    response = ErrorHelper.CreateErrorResponse(Constants.TypeNotifySpectrumUsageResponse, Constants.ErrorMessageServerError);
                }

                // End Log transaction
                this.PawsLogger.Log(TraceEventType.Information, LoggingMessageId.PAWSGenericMessage, "Exit " + LogMethodName);

                // Return Response
                return(response);
            }
            catch (Exception ex)
            {
                // Log failed transaction
                this.PawsLogger.Log(TraceEventType.Error, LoggingMessageId.PAWSGenericMessage, ex.ToString());
                PawsResponse resp = ErrorHelper.CreateExceptionResponse(Constants.TypeNotifySpectrumUsageResponse, ex.ToString());
                return(resp);
            }
        }
Beispiel #8
0
        /// <summary>
        /// validates slave
        /// </summary>
        /// <param name="parameters">parameters coming from master device</param>
        /// <returns>Returns the paws response.</returns>
        public PawsResponse ValidateDevice(Parameters parameters)
        {
            const string LogMethodName = "PawsManager.ValidateDevice(Parameters parameters)";

            try
            {
                // Begin Log transaction
                this.PawsLogger.Log(TraceEventType.Information, LoggingMessageId.PAWSGenericMessage, "Enter " + LogMethodName);
                Check.IsNotNull <ParametersBase>(parameters, Constants.ParameterNameParameters);

                DeviceValidityRequestBase deviceValidRequest = parameters.GetDeviceValidRequest();
                List <string>             errorMessages      = null;

                if (!this.PawsValidator.ValidateDeviceRequest(deviceValidRequest, out errorMessages))
                {
                    return(ErrorHelper.CreateErrorResponse(Constants.TypeDeviceValidationResponse, errorMessages.ToArray()));
                }

                if (this.version != parameters.Version)
                {
                    return(ErrorHelper.CreateErrorResponse(Constants.TypeDeviceValidationResponse, Constants.ErrorMessageDatabaseUnsupported));
                }

                PawsResponse deviceValidResponse = new PawsResponse();
                deviceValidResponse.JsonRpc = "2.0";
                //// Route to device validation method in WhiteSpace Driver
                for (int deviceIndex = 0; deviceIndex < deviceValidRequest.DevicesDescriptors.Count(); deviceIndex++)
                {
                    if (deviceValidResponse.Result == null)
                    {
                        deviceValidResponse.Result = new Result();
                    }

                    deviceValidResponse.Result.Type    = Constants.TypeDeviceValidationResponse;
                    deviceValidResponse.Result.Version = this.version;
                    if (deviceValidResponse.Result.DeviceValidities == null)
                    {
                        deviceValidResponse.Result.DeviceValidities = new DeviceValidity[deviceValidRequest.DevicesDescriptors.Count()];
                    }

                    deviceValidResponse.Result.DeviceValidities[deviceIndex] = new DeviceValidity();
                    deviceValidResponse.Result.DeviceValidities[deviceIndex].DeviceDesciptor = deviceValidRequest.DevicesDescriptors[deviceIndex];
                    deviceValidResponse.Result.DeviceValidities[deviceIndex].IsValid         = false;
                    int validDeviceResponse = this.PawsDriver.ValidateDevice(deviceValidRequest, deviceIndex);
                    if (validDeviceResponse == -32000)
                    {
                        deviceValidResponse.Result        = null;
                        deviceValidResponse.Error         = new Result();
                        deviceValidResponse.Error.Code    = "-32000";
                        deviceValidResponse.Error.Message = "The web service is down";
                    }
                    else if (validDeviceResponse == 1)
                    {
                        deviceValidResponse.Result.DeviceValidities[deviceIndex].IsValid = true;
                    }
                    else
                    {
                        deviceValidResponse.Result.DeviceValidities[deviceIndex].Reason = Constants.InvalidDeviceReasonMessage;
                    }
                }

                // End Log transaction
                this.PawsLogger.Log(TraceEventType.Information, LoggingMessageId.PAWSGenericMessage, "Exit " + LogMethodName);

                // Return Response
                return(deviceValidResponse);
            }
            catch (Exception ex)
            {
                // Log failed transaction
                this.PawsLogger.Log(TraceEventType.Error, LoggingMessageId.PAWSGenericMessage, ex.ToString());
                return(ErrorHelper.CreateExceptionResponse(Constants.TypeDeviceValidationResponse, ex.ToString()));
            }
        }
Beispiel #9
0
        /// <summary>
        /// Master Device query for available spectrum
        /// </summary>
        /// <param name="parameters">parameters coming from master device</param>
        /// <returns>Returns the paws response.</returns>
        public PawsResponse AvailableSpectrum(Parameters parameters)
        {
            const string LogMethodName = "PawsManager.AvailableSpectrum(Parameters parameters)";

            // Begin Log transaction
            this.PawsLogger.Log(TraceEventType.Information, LoggingMessageId.PAWSGenericMessage, "Enter " + LogMethodName);
            Check.IsNotNull <ParametersBase>(parameters, Constants.ParameterNameParameters);

            PawsResponse resultResponse = null;

            try
            {
                string requestVersion = parameters.Version;

                if (requestVersion != this.version)
                {
                    return(ErrorHelper.CreateErrorResponse(Constants.TypeAvailableSpectrumResponse, Constants.ErrorMessageDatabaseUnsupported));
                }

                AvailableSpectrumRequestBase spectrumRequest = parameters.GetAvailableSpectrumRequest();
                List <string> errorMessages;

                // Validate Parameters specific to Available Spectrum Query
                if (!this.PawsValidator.ValidateSpectrumQueryRequest(spectrumRequest, out errorMessages))
                {
                    return(ErrorHelper.CreateErrorResponse(Constants.TypeAvailableSpectrumResponse, errorMessages.ToArray()));
                }

                // Route to GetAvailableSpectrum method in WhiteSpace Driver
                var spectrumSchedules = this.PawsDriver.GetAvailableSpectrum(spectrumRequest);
                List <SpectrumSpec> spectrumSpecArray = new List <SpectrumSpec>();
                RulesetInfo[]       ruleSetInfo       = this.PawsDriver.GetRuleSetInfo(spectrumRequest.DeviceDescriptor);
                foreach (RulesetInfo rs in ruleSetInfo)
                {
                    float?maxTotalBwKhz          = null;
                    float?maxNominalChannelBwKhz = null;
                    if (rs.MaxTotalBwMhz.HasValue)
                    {
                        maxTotalBwKhz = (float)rs.MaxTotalBwMhz;
                    }

                    if (rs.MaxNominalChannelBwMhz.HasValue)
                    {
                        maxNominalChannelBwKhz = (float)rs.MaxNominalChannelBwMhz;
                    }

                    SpectrumSpec spectrumSpec = new SpectrumSpec();
                    spectrumSpec.RulesetInfo         = rs;
                    spectrumSpec.SpectrumSchedules   = spectrumSchedules;
                    spectrumSpec.NeedsSpectrumReport = true;
                    spectrumSpec.MaxTotalBwHz        = maxTotalBwKhz;
                    spectrumSpec.MaxContiguousBwHz   = maxNominalChannelBwKhz;
                    spectrumSpecArray.Add(spectrumSpec);
                }

                resultResponse = new PawsResponse
                {
                    JsonRpc = "2.0",
                    Result  = new Result
                    {
                        Type             = Constants.TypeAvailableSpectrumResponse,
                        Version          = this.version,
                        TimeStamp        = DateTime.UtcNow.ToString("u"),
                        DeviceDescriptor = spectrumRequest.DeviceDescriptor,
                        SpectrumSpecs    = spectrumSpecArray.ToArray()
                    }
                };
            }
            catch (Exception ex)
            {
                // Log failed transaction
                this.PawsLogger.Log(TraceEventType.Error, LoggingMessageId.PAWSGenericMessage, ex.ToString());
                resultResponse = ErrorHelper.CreateExceptionResponse(Constants.TypeAvailableSpectrumResponse, ex.ToString());
            }

            // End Log transaction
            this.PawsLogger.Log(TraceEventType.Information, LoggingMessageId.PAWSGenericMessage, "Exit " + LogMethodName);

            // Return Response
            return(resultResponse);
        }
Beispiel #10
0
        public PawsResponse Post(HttpRequestMessage httpRequest)
        {
            PawsResponse postResponse = new PawsResponse();
            string       methodId     = string.Empty;
            Request      requestparam = new Request();

            try
            {
                // Begin Log transaction
                this.PawsLogger.Log(TraceEventType.Information, LoggingMessageId.PAWSGenericMessage, "Enter " + this.methodName);

                // Begin elapsed time calculation
                this.stopWatch = new Stopwatch();
                this.stopWatch.Start();

                try
                {
                    requestparam = JsonSerialization.DeserializeString <Request>(httpRequest.Content.ReadAsStringAsync().Result);
                }
                catch (Exception)
                {
                    return(new PawsResponse
                    {
                        JsonRpc = "2.0",
                        Error = new Result
                        {
                            Code = "-201",
                            Message = Constants.InvalidRequest
                        }
                    });
                }

                postResponse = this.Router(requestparam);

                if (postResponse.Error != null)
                {
                    postResponse.Error.Version = requestparam.Params.Version;
                }

                // Populate audit id based on method in the request
                string auditMethod;

                this.auditId         = PawsUtil.GetAuditId(requestparam.Method, out auditMethod);
                this.auditMethodName = auditMethod;

                // End Audit transaction
                this.PawsAuditor.UserId        = this.PawsLogger.UserId;
                this.PawsAuditor.TransactionId = this.PawsLogger.TransactionId;
                this.PawsAuditor.RegionCode    = Utils.Configuration.CurrentRegionId;

                // End Elapsed Time Calculation
                this.stopWatch.Stop();
                this.elapsedTime = this.stopWatch.ElapsedMilliseconds;
                if (postResponse.Result == null && postResponse.Error.Code != null)
                {
                    this.PawsAuditor.Audit(this.auditId, AuditStatus.Failure, this.elapsedTime, this.auditMethodName + " failed");
                }
                else if (postResponse.Error == null && postResponse.Result.Type != null)
                {
                    this.PawsAuditor.Audit(this.auditId, AuditStatus.Success, this.elapsedTime, this.auditMethodName + " passed");
                }

                // End Log transaction
                this.PawsLogger.Log(TraceEventType.Information, LoggingMessageId.PAWSGenericMessage, "Exit " + this.methodName);
                return(postResponse);
            }
            catch (Exception exception)
            {
                // Log transaction Failure
                this.PawsLogger.Log(TraceEventType.Error, LoggingMessageId.PAWSGenericMessage, exception.ToString());

                // Audit transaction Failure
                this.PawsAuditor.UserId        = this.PawsLogger.UserId;
                this.PawsAuditor.TransactionId = this.PawsLogger.TransactionId;
                this.PawsAuditor.RegionCode    = Utils.Configuration.CurrentRegionId;

                string auditMethod;

                this.auditId         = PawsUtil.GetAuditId(requestparam.Method, out auditMethod);
                this.auditMethodName = auditMethod;

                // End Elapsed Time Calculation
                this.stopWatch.Stop();
                this.elapsedTime = this.stopWatch.ElapsedMilliseconds;
                this.PawsAuditor.Audit(this.auditId, AuditStatus.Failure, this.elapsedTime, this.auditMethodName + " failed");
                return(new PawsResponse
                {
                    JsonRpc = "2.0",
                    Error = new Result
                    {
                        Code = "-201",
                        Message = exception.Message
                    }
                });
            }
        }