public string GetRequest(string json) { string ComponentType = ""; int ComponentQuantity = 0; int Processing = 0; var RequestObject = JsonConvert.DeserializeObject <ProcessRequest>(json); RequestObject = new ProcessRequest { Name = RequestObject.Name, ContactNumber = RequestObject.ContactNumber, CreditCardNumber = RequestObject.CreditCardNumber, ComponentType = RequestObject.ComponentType, ComponentName = RequestObject.ComponentName, Quantity = RequestObject.Quantity, IsPriorityRequest = RequestObject.IsPriorityRequest }; ComponentType = RequestObject.ComponentType; ComponentQuantity = RequestObject.Quantity; Processing = ProcessId(); DateTime date = DateTime.Now; ResponseObject = new ProcessResponse { RequestId = Processing, ProcessingCharge = ProcessingCharge(RequestObject.ComponentType), PackagingAndDeliveryCharge = PackagingDelivery(ComponentType, ComponentQuantity), DateOfDelivery = date }; string ResponseString = JsonConvert.SerializeObject(ResponseObject); return(ResponseString); }
public async Task <IActionResult> ProcessRequest(ProcessRequest processRequest) { ProcessRequest pRequest = new ProcessRequest(); ProcessResponse pResponse = new ProcessResponse(); pRequest.IsPriorityRequest = "No"; using (var httpClient = new HttpClient()) { try { //int id = verify.VerificationId; StringContent content = new StringContent(JsonConvert.SerializeObject(processRequest), Encoding.UTF8, "application/json"); using (var response = await httpClient.PostAsync("http://localhost:34213/api/Process/ProcessRequest", content)) { string apiResponse = await response.Content.ReadAsStringAsync(); //ViewBag.Result = "Success"; pResponse = JsonConvert.DeserializeObject <ProcessResponse>(apiResponse); //ViewBag.Result = "Successfully Registered, Please Login.....THANKYOU"; TempData["pResponse"] = JsonConvert.SerializeObject(pResponse); } TempData["RequestId"] = pResponse.RequestId; TempData["PandD"] = JsonConvert.SerializeObject(pResponse.PackagingAndDeliveryCharge); //TempData["PandD"] = pResponse.PackagingAndDeliveryCharge; TempData["Processing"] = JsonConvert.SerializeObject(pResponse.ProcessingCharge); } catch (Exception) { ViewBag.Message = "Component API not Loaded. Please Try Later."; return(View()); } } return(RedirectToAction("ProcessResponse")); }
public void RunPipeline() { try { Configuration config = GetConfiguration(); Assert.NotNull(config); PipelineBuilder builder = new PipelineBuilder(); builder.Load(config.RootConfigNode); BasicPipeline <User> pipeline = (BasicPipeline <User>)builder.GetPipeline <User>("UserDataPipeline"); Assert.NotNull(pipeline); LogUtils.Debug("UserDataPipeline>>", pipeline); User user = new User(); ProcessResponse <User> response = pipeline.Execute(user, null, null); Assert.Equal(EProcessResponse.FatalError, response.State); user.LastName = "TestUser"; response = pipeline.Execute(user, null, null); Assert.Equal(EProcessResponse.OK, response.State); Assert.False(String.IsNullOrWhiteSpace(user.EmailId)); Assert.False(user.IsAdult); user.FirstName = "First"; user.DateOfBirth = DateTime.Parse("07/21/1953"); response = pipeline.Execute(user, null, null); Assert.Equal(EProcessResponse.OK, response.State); Assert.True(user.IsAdult); } catch (Exception ex) { LogUtils.Error(ex); throw ex; } }
public string GetRequest(string json) { _log4net.Info("GetRequest() called with json input"); RequestObject = JsonConvert.DeserializeObject <ProcessRequest>(json); RequestObject = new ProcessRequest { Name = RequestObject.Name, ContactNumber = RequestObject.ContactNumber, CreditCardNumber = RequestObject.CreditCardNumber, ComponentType = RequestObject.ComponentType, ComponentName = RequestObject.ComponentName, Quantity = RequestObject.Quantity, IsPriorityRequest = RequestObject.IsPriorityRequest }; int Processing = ProcessId(); ResponseObject = new ProcessResponse { RequestId = Processing, ProcessingCharge = ProcessingCharge(RequestObject.ComponentType), PackagingAndDeliveryCharge = PackagingDelivery(RequestObject.ComponentType, RequestObject.Quantity), DateOfDelivery = DeliveryDate() }; var ResponseString = JsonConvert.SerializeObject(ResponseObject); return(ResponseString); }
public void ProcessDocumentResourceNames() { moq::Mock <DocumentProcessorService.DocumentProcessorServiceClient> mockGrpcClient = new moq::Mock <DocumentProcessorService.DocumentProcessorServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); ProcessRequest request = new ProcessRequest { ProcessorName = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]"), }; ProcessResponse expectedResponse = new ProcessResponse { Document = new Document(), #pragma warning disable CS0612 HumanReviewOperation = "human_review_operationb1fb7921", #pragma warning restore CS0612 HumanReviewStatus = new HumanReviewStatus(), }; mockGrpcClient.Setup(x => x.ProcessDocument(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); DocumentProcessorServiceClient client = new DocumentProcessorServiceClientImpl(mockGrpcClient.Object, null); ProcessResponse response = client.ProcessDocument(request.ProcessorName); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task ProcessDocumentRequestObjectAsync() { moq::Mock <DocumentProcessorService.DocumentProcessorServiceClient> mockGrpcClient = new moq::Mock <DocumentProcessorService.DocumentProcessorServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); ProcessRequest request = new ProcessRequest { ProcessorName = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]"), SkipHumanReview = true, InlineDocument = new Document(), RawDocument = new RawDocument(), }; ProcessResponse expectedResponse = new ProcessResponse { Document = new Document(), HumanReviewStatus = new HumanReviewStatus(), }; mockGrpcClient.Setup(x => x.ProcessDocumentAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <ProcessResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); DocumentProcessorServiceClient client = new DocumentProcessorServiceClientImpl(mockGrpcClient.Object, null); ProcessResponse responseCallSettings = await client.ProcessDocumentAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); ProcessResponse responseCancellationToken = await client.ProcessDocumentAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public Customer UpdateCustomer(Customer customer) { try { var client = new RestClient($"{CustomerUrl}{customer.Key}/"); var request = new RestRequest(Method.PUT); request.AddHeader("authorization", $"bearer {this.Token.Access_Token}"); dynamic customerJSON = new JObject(); customerJSON.name = customer.Name; customerJSON.email = customer.Email; customerJSON.currency = customer.Currency; customerJSON.credit_card_number = customer.Card.CardNumber; customerJSON.credit_card_security_code_number = customer.Card.CVC; customerJSON.exp_month = customer.Card.ExpirationMonth; customerJSON.exp_year = customer.Card.ExpirationYear; request.AddParameter("application/json", customerJSON, ParameterType.RequestBody); return(ProcessResponse.Process <Customer>(client.Execute(request))); } catch (Exception ex) { throw ex; } }
public ActionResult LoadBalanceIndex(LoadBalanceModel balance) { LoadBalanceCommon ld = new LoadBalanceCommon(); balance.action_user = Session["UserName"].ToString(); balance.action_ip = ApplicationUtilities.GetIP(); balance.action_browser = HttpContext.Request.Browser.ToString(); ld = balance.MapObject <LoadBalanceCommon>(); string redirectUrl = ""; CommonDbResponse dbResponse = _iLoad.LoadBalance(ld); if (dbResponse.Code == ResponseCode.Success) { var modeleResponse = MakeHttpRequest.InvokeGetProcessId("1", "anujApi", dbResponse.Extra1, balance.amount, "", "anujApi", "Anuj@123", "AnujSecert"); if (modeleResponse.code == "0") { ProcessResponse midddlewareModel = ApplicationUtilities.MapObject <ProcessResponse>(modeleResponse.data); Dictionary <String, string> formParams = new Dictionary <string, string>(); formParams.Add("MerchantId", midddlewareModel.MerchantId); formParams.Add("MerchantTxnId", midddlewareModel.MerchantTxnId); formParams.Add("ProcessId", midddlewareModel.ProcessId); formParams.Add("Amount", midddlewareModel.Amount.ToString()); formParams.Add("TransactionRemarks", balance.remarks); formParams.Add("MerchantName", "anujApi"); var responseObj = ApplicationUtilities.FormBuilder("gateway", midddlewareModel.GatewayFormMethod, midddlewareModel.GatewayUrl, formParams); Response.Write(responseObj); Response.End(); } } return(View(balance)); }
public void ShouldResponseInternalProcessByNumber() { var log = new List <string> { "2018-05-01 12:47:05,691[3] DEBUG Guggenheim.Service.Sentry - Received Msg: TestNumber:123, Shoot # 1, Process: Process16, Port: 518, ID: 9ce2175a-8539-4ab6-b756-31351ac6dbb5", "2018-05-01 12:47:05,692[15] DEBUG Guggenheim.Service.Sentry - Received Msg: TestNumber:123, Shoot # 1, Process: Process11, Port: 513, ID: ac3196b4-b639-4616-b170-5019d7ca1f07", "2018-05-01 12:47:05,692[3] DEBUG Guggenheim.Service.Sentry - Received Msg: TestNumber:123, Shoot # 1, Process: Process10, Port: 512, ID: be76be40-cac8-41b1-b0f9-a948b23c2d31", "2018-05-01 12:47:05,692[21] DEBUG Guggenheim.Service.Sentry - Received Msg: TestNumber:123, Shoot # 1, Process: Process17, Port: 519, ID: 7c43711d-2391-43b9-9719-85f377c16813", "2018-05-01 12:47:05,692[3] DEBUG Guggenheim.Service.Sentry - Received Msg: TestNumber:123, Shoot # 1, Process: Process1, Port: 503, ID: c641b9d1-7bb0-43a7-8d63-80faefe64ffb", "2018-05-01 12:47:05,697 [19] DEBUG Guggenheim.Service.Sentry - Processing message: TestNumber:123, Shoot # 1, Process: Process11, Port: 518, ID: ac3196b4-b639-4616-b170-5019d7ca1f07", "2018-05-01 12:47:05,697 [19] DEBUG Guggenheim.Service.Sentry - Processing message:TestNumber:123, Shoot # 1, Process: Process10, Port: 518, ID: be76be40-cac8-41b1-b0f9-a948b23c2d31", "2018-05-01 12:47:05,697 [19] DEBUG Guggenheim.Service.Sentry - Processing message: TestNumber:123, Shoot # 1, Process: Process16, Port: 518, ID: 9ce2175a-8539-4ab6-b756-31351ac6dbb5", "2018-05-01 12:47:05,691[3] DEBUG Guggenheim.Service.Sentry - Received Msg: TestNumber:44123, Shoot # 1, Process: Process16, Port: 518, ID: 9ce2175a-8539-4ab6-b756-31351ac6dbb5", "2018-05-01 12:47:05,692[15] DEBUG Guggenheim.Service.Sentry - Received Msg: TestNumber:44123, Shoot # 1, Process: Process11, Port: 513, ID: ac3196b4-b639-4616-b170-5019d7ca1f07", "2018-05-01 12:47:05,692[3] DEBUG Guggenheim.Service.Sentry - Received Msg: TestNumber:44123, Shoot # 1, Process: Process10, Port: 512, ID: be76be40-cac8-41b1-b0f9-a948b23c2d31", "2018-05-01 12:47:05,692[21] DEBUG Guggenheim.Service.Sentry - Received Msg: TestNumber:44123, Shoot # 1, Process: Process17, Port: 519, ID: 7c43711d-2391-43b9-9719-85f377c16813", "2018-05-01 12:47:05,692[3] DEBUG Guggenheim.Service.Sentry - Received Msg: TestNumber:44123, Shoot # 1, Process: Process1, Port: 503, ID: c641b9d1-7bb0-43a7-8d63-80faefe64ffb", "2018-05-01 12:47:05,697 [19] DEBUG Guggenheim.Service.Sentry - Processing message: TestNumber:44123, Shoot # 1, Process: Process11, Port: 518, ID: ac3196b4-b639-4616-b170-5019d7ca1f07", "2018-05-01 12:47:05,697 [19] DEBUG Guggenheim.Service.Sentry - Processing message: TestNumber:44123, Shoot # 1, Process: Process10, Port: 518, ID: be76be40-cac8-41b1-b0f9-a948b23c2d31", "2018-05-01 12:47:05,697 [19] DEBUG Guggenheim.Service.Sentry - Processing message:TestNumber:44123, Shoot # 1, Process: Process16, Port: 518, ID: 9ce2175a-8539-4ab6-b756-31351ac6dbb5" }; const string currentTest = "123"; var currentLog = new Log(log, currentTest); string process = "Process11"; var lines = currentLog.Lines.Where(l => l.ProcessId.Equals(process)).ToList(); var processResponse = new ProcessResponse(lines, process); Assert.IsTrue(processResponse.Lines.Count().Equals(2)); Assert.IsTrue(processResponse.Id.Equals(process)); }
private List <ReportInformation> GenerateInformation() { var loadTest = LoadTest; var log = loadTest.Log; var currentDiagnostic = loadTest.Diagnostic; var reports = new List <ReportInformation>(); currentDiagnostic.Processes.ForEach(p => { var logLines = log.Lines.Where(l => l.ProcessId.Equals(p.Id)).ToList(); var processResponse = new ProcessResponse(logLines, p.Id); List <string> yaxisGraph = GetFormatedData(processResponse); var reportInformation = new Dictionary <string, string>(); reportInformation.Add("%RenderPoints%", string.Join(",", yaxisGraph)); reportInformation.Add("%GraphTitle%", string.Format("Performance Graphic {0} with , {1} messages", p.Id, p.Messages)); reportInformation.Add("%SendedMessages%", p.UnprocessedMessages.ToString()); reportInformation.Add("%RecievedMessages%", p.ProcessedMessages.ToString()); reportInformation.Add("%ProcessedMessages%", p.UnprocessedMessages.ToString()); reportInformation.Add("%AverageTimeResponse%", processResponse.AverageProcess.ToString() + " ms"); var report = new ReportInformation.Builder(p.Id) .WithAttributes(reportInformation) .ByLoadTest(loadTest) .Build(); reports.Add(report); }); return(reports); }
private static List <string> GetFormatedData(ProcessResponse processResponse) { var yaxisGraph = new List <string>(); processResponse.Messages.ForEach(pA => { yaxisGraph.Add(GetSecondsProcces(pA.ProcessingTime)); }); return(yaxisGraph); }
public bool CreatePlan(Plan plan) { try { var client = new RestClient(PlanCreateUrl); var request = new RestRequest(Method.POST); request.AddHeader("authorization", $"bearer {this.Token.Access_Token}"); dynamic planJSON = new JObject(); planJSON.name = plan.Name; planJSON.amount = 10.50;// plan.Amount.ToString(); planJSON.trial_period_days = plan.TrialPeriodDays; planJSON.interval = plan.Interval.ToString(); planJSON.interval_count = plan.IntervalCount.ToString(); planJSON.credit_card_description = plan.CreditCardDescription; planJSON.currency = plan.Currency; request.AddParameter("application/json", planJSON, ParameterType.RequestBody); return(ProcessResponse.Process(client.Execute(request), HttpStatusCode.Created)); } catch (Exception ex) { throw ex; } }
/// <summary> /// Reads a text file, sorts its content and generate output files /// according to predefined business rules /// </summary> /// <param name="file">The text file absolute path</param> public ProcessResponse ProcessInputFile(string file) { var processResponse = new ProcessResponse(); processResponse.Success = true; try { ReadAndSortInputFile(file); var generatedFiles = GenerateOutputFiles(); if (!generatedFiles) { processResponse.Success = false; processResponse.Message = "Error while trying to generate output files"; } } catch (Exception ex) { processResponse.Success = false; processResponse.Message = ex.Message; } return(processResponse); }
public void ProcessDocumentRequestObject() { moq::Mock <DocumentProcessorService.DocumentProcessorServiceClient> mockGrpcClient = new moq::Mock <DocumentProcessorService.DocumentProcessorServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); ProcessRequest request = new ProcessRequest { ProcessorName = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]"), SkipHumanReview = true, InlineDocument = new Document(), RawDocument = new RawDocument(), }; ProcessResponse expectedResponse = new ProcessResponse { Document = new Document(), HumanReviewStatus = new HumanReviewStatus(), }; mockGrpcClient.Setup(x => x.ProcessDocument(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); DocumentProcessorServiceClient client = new DocumentProcessorServiceClientImpl(mockGrpcClient.Object, null); ProcessResponse response = client.ProcessDocument(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task <IActionResult> CompleteProcess(int RequestId) { ProcessResponse pResponse = new ProcessResponse(); string pay; using (var httpClient = new HttpClient()) { try { using (var response = await httpClient.GetAsync("http://localhost:34213/api/Process/CompleteProcessing/" + RequestId)) { string apiResponse = await response.Content.ReadAsStringAsync(); pay = Convert.ToString(apiResponse); } TempData["pay"] = pay; } catch (Exception e) { ViewBag.Message = "Component API not Loaded. Please Try Later."; return(View()); } } return(View()); }
public IActionResult ProcessResponse(ProcessResponse pResponse) { string strUser = TempData.Peek("pResponse").ToString(); pResponse = JsonConvert.DeserializeObject <ProcessResponse>(strUser); return(View(pResponse)); }
public ProcessResponse SaveServiceAd(YPServicePostRequest request) { ProcessResponse pr = new ProcessResponse(); YPServicePostRequestFinal final = new YPServicePostRequestFinal(); CloneObjects.CopyPropertiesTo(request, final); var apiResponse = _iIYPAdManagementRepository.SaveServiceAd(final, APIUri.PostYPAdd); return(pr); }
public Unit Execute(Unit unit, object parameters) { var compassDirection = (CompassDirection)parameters; INewLocationCalculator newLocationCalculator = NewLocationCalculatorFactory.GetNewLocationCalculator(compassDirection); ProcessResponse response = Globals.Instance.GameWorld.MovementProcessor.Process(new ProcessRequest(unit.Location, unit.MovementPoints), newLocationCalculator); Unit ret = Unit.Create(unit.UnitType, response.NewLocation, response.NewMovementPoints); return(ret); }
public string PaymentProcess(long CreditCardNumber, int CreditLimit, double ProcessingCharge) { ProcessDetail processDetail = new ProcessDetail(); ProcessResponse processResponse = new ProcessResponse(); ProcessRequest processRequest = new ProcessRequest(); var p = _context.ProcessDetails.FirstOrDefault(c => c.CreditCardNumber == CreditCardNumber); var BalanceAmount = Convert.ToString(CreditLimit - (p.PackagingAndDeliveryCharge + p.ProcessingCharge)); return(BalanceAmount); }
public static CommonResponse InvokeGetProcessId(string MerchantId, string MerchantName, string MerchantTxnId, string Amount, string TransactionRemarks, string ApiUsername, string ApiPassword, string ApiSecretKey) { ApiLogBusiness _apiLog = new ApiLogBusiness(); AuthenticationLogRequest authLog; using (WebClient client = new WebClient()) { client.Credentials = new NetworkCredential(ApiUsername, ApiPassword); var postValues = new NameValueCollection(); postValues["MerchantId"] = MerchantId; postValues["MerchantName"] = MerchantName; postValues["Amount"] = Amount.ToString(); postValues["MerchantTxnId"] = MerchantTxnId; postValues["Signature"] = HMACSignatureGenerator .SHA512_ComputeHash(CommonFunctions.SingnatureGenerator <AuthenticationLogRequest>(authLog = new AuthenticationLogRequest { Amount = Amount, MerchantId = MerchantId, MerchantName = MerchantName, MerchantTxnId = MerchantTxnId }), ApiSecretKey); var response = client.UploadValues(GetApiUrl() + "/GetProcessId", "Post", postValues); var responseString = Encoding.Default.GetString(response); var responseModel = responseString.SerializeJSON <CommonResponse>(); //maintain log _apiLog.InsertApiLog(new ApiLogCommon() { apiRequest = JsonConvert.SerializeObject(authLog), apiResponse = responseModel.data.SerializeObjectToJSON(), userId = HttpContext.Current.Session["UserName"].ToString(), IpAddress = ApplicationUtilities.GetIP(), functionName = "GetProcessId" }); //end if (responseModel.code == "0") { ProcessResponse pRes = new ProcessResponse() { MerchantId = MerchantId, MerchantTxnId = MerchantTxnId, Amount = Amount, ProcessId = responseModel.data.ToString().SerializeJSON <ProcessIdResponse>().ProcessId, GatewayUrl = CommonFunctions.Getwayurl(), GatewayFormMethod = "Post" }; responseModel.data = pRes; return(responseModel); } //var s = responseModel.data.ToString(); ////var s1 = s.Split(new char [] { ':'}); //var getProcessId = responseModel.data.ToString().SerializeJSON<ProcessIdResponse>(); //if (getProcessId != null) //{ // return getProcessId.ProcessId; //} return(responseModel); } }
public ProcessResponse Process(ProcessRequest request) { var response = new ProcessResponse(); foreach (var command in _commandFactory.Create(request.CommandType)) { response.Messages.Add(command.Process(request)); } return(response); }
public ProcessResponse RegisterUser(CustomerSaveRequest request) { ProcessResponse pr = new ProcessResponse(); var apiResponse = _userMgmtRepository.RegisterUser(request, APIUri.RegiserUser); if (apiResponse.Succeded) { pr = apiResponse.Response; } return(pr); }
/// <summary> /// Create ProcessResult object from response /// </summary> /// <param name="response"></param> /// <returns></returns> private ProcessResult Create(ProcessResponse response) { return(new ProcessResult { ErrorOccurred = (response.ResponseCode != "OK"), ErrorMessage = (response.ResponseCode != "OK" ? string.Format("{0}/{1}: {2}", response.ResponseCode, response.ResponseSource, response.ResponseText) : string.Empty), ResponseCode = response.ResponseCode, ResponseText = response.ResponseText, ResponseSource = response.ResponseSource }); }
public ProcessResponse EmailAvailableCheck(LoginRequest request) { ProcessResponse pr = new ProcessResponse(); var apiResponse = _userMgmtRepository.EmailAvailableCheck(request, APIUri.EmailAwailabiltyCheck); if (apiResponse.Succeded) { pr = apiResponse.Response; } return(pr); }
/// <summary>Snippet for ProcessDocument</summary> public void ProcessDocument() { // Snippet: ProcessDocument(string, CallSettings) // Create client DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.Create(); // Initialize request argument(s) string name = "projects/[PROJECT]/locations/[LOCATION]/processors/[PROCESSOR]"; // Make the request ProcessResponse response = documentProcessorServiceClient.ProcessDocument(name); // End snippet }
/// <summary>Snippet for ProcessDocument</summary> public void ProcessDocumentResourceNames() { // Snippet: ProcessDocument(ProcessorName, CallSettings) // Create client DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.Create(); // Initialize request argument(s) ProcessorName name = ProcessorName.FromProjectLocationProcessor("[PROJECT]", "[LOCATION]", "[PROCESSOR]"); // Make the request ProcessResponse response = documentProcessorServiceClient.ProcessDocument(name); // End snippet }
private void ResponseCallback(ProcessResponse response) { if (response.Error != null) { LogUtils.Error(response.Error); throw response.Error; } else { LogUtils.Info(String.Format("Processed Document. [source={0}][output={1}]", response.SourceDoc, response.OutputFile)); } }
public override void Update() { if (Response != null) { ProcessResponse?.Invoke(Response); Stop(); } else if (RequestException != null) { Stop(); } }
public void DoHandle(ProcessRequest processRequest, ProcessResponse processResponse) { foreach (var request in processRequest.Requests) { var handler = GetRequestHandlerByInstanceId(request); if (handler != null) { processResponse.Responses.Add(handler.DoHandle(request)); } } }
//Form is being filled by the user and the form data is being sent to Component Microservice public async Task <ActionResult> ComponentProcessing(Component component) { try { _log4net.Info("ComponentProcessingMicroservice initiated"); string Results; using (var client = new HttpClient()) { Component components = new Component { Name = component.Name, ContactNumber = component.ContactNumber, CreditCardNumber = component.CreditCardNumber, ComponentType = component.ComponentType, ComponentName = component.ComponentName, Quantity = component.Quantity, IsPriorityRequest = component.IsPriorityRequest }; // client.DefaultRequestHeaders.Accept.Clear(); _log4net.Info("Token added to header"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + TokenForLogin); //client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var myJSON = JsonConvert.SerializeObject(components); string uri = string.Format("https://localhost:44392/api/ComponentProcessingMicroservice?json={0}", myJSON); // string uri = string.Format(_config["Links:ComponentMicroService"] + "/ComponentProcessingMicroservice?json={0}", myJSON); _log4net.Info("Component Microservice uri invoked http://52.154.250.90/api"); HttpResponseMessage response = await client.GetAsync(uri); if (response.IsSuccessStatusCode) { Results = await response.Content.ReadAsStringAsync(); } else { Results = null; } } _log4net.Info("Response Received From Component Microservice"); Response = JsonConvert.DeserializeObject <ProcessResponse>(Results); return(View("ProcessResponse", Response)); } catch (Exception ex) { _log4net.Info("Exception In Component ActionResult"); return(View("Error1", ex)); } }
// Simulates outgoing map execution delay. private static MapperOutMessage InnerMapOut(ProcessResponse response) { // set actual timestamp var externalServiceResponded = DateTime.Now.Ticks; // convert external service response to outgoing message var message = new MapperOutMessage(response) { ServiceResponded = externalServiceResponded }; // delay InnerMap(); return message; }
public MapperOutMessage(ProcessResponse response) { Id = response.Id; Payload = response.Payload; Produced = response.Produced; MapperActivated = response.MapperActivated; MapperConnected = response.MapperConnected; MapperPreDequeued = response.MapperPreDequeued; MapperPostDequeued = response.MapperPostDequeued; MapperReceived = response.MapperReceived; MapperSent = response.MapperSent; ServiceReceived = response.ServiceReceived; ServiceSent = response.ServiceSent; }
protected void Page_Load(object sender, EventArgs e) { string returnUrl = Request.Url.AbsoluteUri; UserLogin.LoginCheck ul = new UserLogin.LoginCheck(); if (ul.UserIsLogin) { ProcessResponse pr = new ProcessResponse(); string a = pr.createSamlResponse(Util.HashUserName(ul.UserName).ToLower(), "0", "0", "0", "0"); Response.Write("<script>alert('" + Util.GetUserNameInGoogleUser(ul.UserName) + "');</script>"); } else { Response.Redirect("http://passport.cga.com.cn/login/loginto.aspx?returnurl=" + Server.UrlEncode(returnUrl).ToString());//参数中带有参数 } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { string returnUrl = Request.Url.AbsoluteUri; if (!login.UserIsLogin) { Response.Redirect("http://passport.cga.com.cn/login/loginto.aspx?returnurl=" + Server.UrlEncode(returnUrl).ToString());//参数中带有参数 } else { try { ProcessResponse res = new ProcessResponse(); res.doPost(Request); } catch (Exception ex) { if (ex.Message == "正在中止线程。") { return; } else if (ex.Message == "Thread was being aborted.") { return; } else { Util.LogsError(login.UserName, ex.Message); Response.Write(ex.Message); } } } } }