private void AddUpsSecurity(RateService upsService)
 {
     var upss = new UPSRateService.UPSSecurity();
     AddUpsServiceAccessToken(upss);
     AddUserNameToken(upss);
     upsService.UPSSecurityValue = upss;
 }
 //, out string requestXML)
 public RateResponse CallUPSRateRequest(string serviceCode, int Qty, int nrBoxes, int itemsInLastBox, string fullBoxWeight, int valuePerFullBox, int valuePerPartialBox, string partialBoxWeight, inv_detl details, string packagingTypeCode, string currencyCode, decimal unitPrice, bool isResidentialAddress)
 {
     var upsService = new RateService();
     var rateResponse = new RateResponse();
     var rateRequest = new RateRequest();
     AddCustomerClassification(rateRequest);
     AddUpsSecurity(upsService);
     var request = new RequestType();
     String[] requestOption = { "Rate" };
     request.RequestOption = requestOption; //this can be Rate or Shop
     rateRequest.Request = request;
     var shipment = new UPSRateService.ShipmentType();
     AddShipper(shipment);
     AddShipFromAddress(shipment);
     AddShipToAddress(shipment, isResidentialAddress);
     var service = new CodeDescriptionType();
     service.Code = serviceCode;
     shipment.Service = service;
     var optype = new UPSRateService.ShipmentRatingOptionsType();
     optype.NegotiatedRatesIndicator = string.Empty;
     shipment.ShipmentRatingOptions = optype;
     AddPackageArray(nrBoxes, itemsInLastBox, fullBoxWeight, partialBoxWeight, valuePerFullBox, valuePerPartialBox, details, packagingTypeCode, currencyCode, shipment);
     AddInvoiceTotalType(Qty, unitPrice, shipment);
     rateRequest.Shipment = shipment;
     //var serializer = new XmlSerializer(typeof(RateRequest));
     //using (var writer = new StringWriter())
     //{
     //  serializer.Serialize(writer, rateRequest);
     //  requestXML = writer.ToString();
     //}
     rateResponse = upsService.ProcessRate(rateRequest);
     return rateResponse;
 }