private RateResponse CallUPSRateRequest(string scode, int Qty, int nrBoxes, int itemsInLastBox, string fullBoxWeight, int valuePerFullBox, int valuePerPartialBox, string partialBoxWeight, inv_detl details, decimal unitPrice, RateService upsService) { RateResponse rateResponse = new RateResponse(); try { RateRequest rateRequest = new RateRequest(); AddCustomerClassification(rateRequest); AddUpsSecurity(upsService); UPS_Shipping_Rate.UPSRateService.RequestType request = new RequestType(); String[] requestOption = { "Rate" }; request.RequestOption = requestOption; rateRequest.Request = request; ShipmentType shipment = new ShipmentType(); AddShipper(shipment); AddShipFromAddress(shipment); AddShipToAddress(shipment); UPS_Shipping_Rate.UPSRateService.CodeDescriptionType service = new UPS_Shipping_Rate.UPSRateService.CodeDescriptionType(); service.Code = scode.ToString(); shipment.Service = service; ShipmentRatingOptionsType optype = new ShipmentRatingOptionsType(); optype.NegotiatedRatesIndicator = string.Empty; shipment.ShipmentRatingOptions = optype; AddPackageArray(nrBoxes, itemsInLastBox, fullBoxWeight, partialBoxWeight, valuePerFullBox, valuePerPartialBox, details, shipment); AddInvoiceTotalType(Qty, unitPrice, shipment); rateRequest.Shipment = shipment; // ServicePointManager.ServerCertificateValidationCallback = ValidateRemoteCertificate; rateResponse = upsService.ProcessRate(rateRequest); } catch (Exception ex) { } return rateResponse; }