public WsMotorServiceResponse Validate(WsMotorRequest wsMotorRequest) { if (wsMotorRequest == null) { throw new ArgumentNullException(nameof(wsMotorRequest)); } wsMotorRequest.UsertNit = ConfigurationManager.AppSettings["WsMotorUserNit"]; wsMotorRequest.UserType = ConfigurationManager.AppSettings["WsMotorUserType"]; wsMotorRequest.User = ConfigurationManager.AppSettings["WsMotorUser"]; var consultation = _webSettingsConsultationSettingsBuilder.WithPayload(JsonConvert.SerializeObject(wsMotorRequest)) .WithExecutionId(wsMotorRequest.ExecutionId) .WithTypeOfConsultation((int)TypeOfConsultation.Request) .WithWebServiceName(ServiceNameType.WsMotorValidate.GetStringValue()) .Build(); AddWebServiceConsultation(consultation); var response = _wsMotorRepository.Validate(wsMotorRequest); var consultationResponse = _webSettingsConsultationSettingsBuilder.WithPayload(JsonConvert.SerializeObject(response)) .WithExecutionId(wsMotorRequest.ExecutionId) .WithTypeOfConsultation((int)TypeOfConsultation.Response) .WithWebServiceName(ServiceNameType.WsMotorValidate.GetStringValue()) .Build(); AddWebServiceConsultation(consultationResponse); return(response); }
public WsMotorServiceResponse Validate(WsMotorRequest wsMotorRequest) { if (wsMotorRequest == null) { throw new ArgumentNullException(nameof(wsMotorRequest)); } var mock = bool.Parse(ConfigurationManager.AppSettings.Get("Mock")); if (!mock) { try { wsMotorRequest.Parameters.Parameter.Add(new Parameter { Name = "STRAID", Type = "T", Value = "2600" }); wsMotorRequest.Parameters.Parameter.Add(new Parameter { Name = "STRNAM", Type = "T", Value = "SuperSymmetry" }); var serialized = _xmlProcessor.Serialize(wsMotorRequest); var response = executeStrategy(serialized); var deserialized = _xmlProcessor.Deserialize <WsMotorServiceResponse>(response); return(deserialized); } catch (Exception exception) { var clientLog = new TelemetryClient(); clientLog.TrackException(exception); return(new WsMotorServiceResponse { ScoresMotor = new ScoresMotor { ScoreMotor = new ScoreMotor { Type = "10", Score = "0.0", Classification = "N" } } }); } } return(new WsMotorServiceResponse { ScoresMotor = new ScoresMotor { ScoreMotor = new ScoreMotor { Type = "10", Score = "0.0", Classification = "A" } } }); }