コード例 #1
0
 public ActionResult CalculateFee(CalculateFeeModels.FEE fee)
 {
     try
     {
         ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;//Needed for .net4.5 and below
         var request = new RestRequest("api/fee", Method.POST)
         {
             RequestFormat = DataFormat.Json
         };
         request.AddBody(fee);
         IRestResponse response = client.Execute <CalculateFeeResponseModels.FEE>(request);
         //send data to partial view so it can be displayed//
         TempData["CalculateFeeResponse"] = JsonConvert.DeserializeObject <CalculateFeeResponseModels.FEE>(response.Content);
         return(View());
     }
     catch (Exception e)
     {
         return(View("Error"));
     }
 }
コード例 #2
0
 public ActionResult CalculateFee(CalculateFeeModels.FEE collection)
 {
     try
     {
         com.collectorsolutions.secure.legacy.ProcessingGateway ws = new com.collectorsolutions.secure.legacy.ProcessingGateway(); //The web service
         XmlDocument         xmlRequest = new XmlDocument();
         XMLObjectSerializer obj        = new XMLObjectSerializer();
         xmlRequest.LoadXml(obj.objectXMLConverter <CalculateFeeModels.FEE>(collection));
         //post/receive response//
         var reader     = new StringReader(ws.calculateFee(xmlRequest).OuterXml);
         var serializer = new XmlSerializer(typeof(CalculateFeeResponseModels.FEE));
         var response   = (CalculateFeeResponseModels.FEE)serializer.Deserialize(reader);
         //send data to partial view so it can be displayed//
         TempData["CalculateFeeResponse"] = response;
         return(View());
     }
     catch
     {
         return(View());
     }
 }
コード例 #3
0
 public ActionResult CalculateFee(CalculateFeeModels.FEE fee)
 {
     try
     {
         ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
         com.collectorsolutions.stage.ProcessingGateway ws = new com.collectorsolutions.stage.ProcessingGateway(); //The web service
         XmlDocument         xmlRequest = new XmlDocument();
         XMLObjectSerializer obj        = new XMLObjectSerializer();
         xmlRequest.LoadXml(obj.objectXMLConverter <CalculateFeeModels.FEE>(fee));
         //post/receive response//
         var reader     = new StringReader(ws.calculateFee(xmlRequest).OuterXml);
         var serializer = new XmlSerializer(typeof(CalculateFeeResponseModels.FEE));
         var response   = (CalculateFeeResponseModels.FEE)serializer.Deserialize(reader);
         //send data to partial view so it can be displayed//
         TempData["CalculateFeeResponse"] = response;
         return(View());
     }
     catch (Exception e)
     {
         return(View("Error"));
     }
 }