shipping - UPS Rating API C# .Net -
i trying ups rating api supports time in transit work. have latest wsdl (ups api). keep getting exception error "an exception has been raised result of client data." , can not figure out problem. note: "rate" requestoption works no issues - when timeintransit , deliveryinformation data commented out.
what wrong? appreciated, thank you.
here c# code:
upsratews.requesttype request = new upsratews.requesttype(); string[] requestoption = { "ratetimeintransit" }; request.requestoption = requestoption; request.subversion = "1601"; raterequest.request = request; upsratews.shipmenttype shipment = new upsratews.shipmenttype(); upsratews.shippertype shipper = new upsratews.shippertype(); upsratews.shipmentratingoptionstype shipmentratingoptions = new upsratews.shipmentratingoptionstype(); shipmentratingoptions.negotiatedratesindicator = ""; shipmentratingoptions.ratechartindicator = ""; shipment.shipmentratingoptions = shipmentratingoptions; upsratews.timeintransitrequesttype timeintransit = new upsratews.timeintransitrequesttype(); upsratews.pickuptype pickupintransittype = new upsratews.pickuptype(); pickupintransittype.date = "20170414"; pickupintransittype.time = "1630"; timeintransit.pickup = pickupintransittype; timeintransit.packagebilltype = "02"; shipment.numofpieces = "1"; shipment.deliverytimeinformation = timeintransit; upsratews.shipmentweighttype shipweighttype = new upsratews.shipmentweighttype(); shipweighttype.weight = "10.80"; upsratews.codedescriptiontype shipweightuom = new upsratews.codedescriptiontype(); shipweightuom.code = "lbs"; shipweightuom.description = "pounds"; shipweighttype.unitofmeasurement = shipweightuom; shipment.shipmenttotalweight = shipweighttype; shipper.shippernumber = "xxxxxx"; upsratews.addresstype shipperaddress = new upsratews.addresstype(); string testaddr = "7650 tyler blvd"; string[] addressline = { testaddr }; shipperaddress.addressline = addressline; shipperaddress.city = "mentor"; shipperaddress.postalcode = "44060"; shipperaddress.stateprovincecode = "oh"; shipperaddress.countrycode = "us"; shipperaddress.addressline = addressline; shipper.address = shipperaddress; shipment.shipper = shipper; upsratews.shipfromtype shipfrom = new upsratews.shipfromtype(); upsratews.shipaddresstype shipfromaddress = new upsratews.shipaddresstype(); string testaddr2 = ""; string[] addressline1 = { testaddr2 }; shipfromaddress.addressline = addressline1; shipfromaddress.city = ""; shipfromaddress.postalcode = "45069"; shipfromaddress.stateprovincecode = "oh"; shipfromaddress.countrycode = "us"; shipfrom.address = shipfromaddress; shipment.shipfrom = shipfrom; upsratews.shiptotype shipto = new upsratews.shiptotype(); upsratews.shiptoaddresstype shiptoaddress = new upsratews.shiptoaddresstype(); string testaddr3 = "7650 tyler blvd"; string[] addressline2 = { testaddr3 }; shiptoaddress.addressline = addressline2; shiptoaddress.city = "mentor"; shiptoaddress.postalcode = "44060"; shiptoaddress.stateprovincecode = "oh"; shiptoaddress.countrycode = "us"; shiptoaddress.residentialaddressindicator = "1"; shipto.address = shiptoaddress; shipment.shipto = shipto; upsratews.codedescriptiontype service = new upsratews.codedescriptiontype(); service.code = "03"; shipment.service = service; upsratews.packagetype package = new upsratews.packagetype(); upsratews.packageweighttype packageweight = new upsratews.packageweighttype(); packageweight.weight = "10.80"; upsratews.codedescriptiontype uom = new upsratews.codedescriptiontype(); uom.code = "lbs"; uom.description = "pounds"; packageweight.unitofmeasurement = uom; package.packageweight = packageweight; upsratews.codedescriptiontype packtype = new upsratews.codedescriptiontype(); packtype.code = "02"; package.packagingtype = packtype; upsratews.packageserviceoptionstype packservtype = new upsratews.packageserviceoptionstype(); upsratews.insuredvaluetype insuredvaluetype = new upsratews.insuredvaluetype(); insuredvaluetype.currencycode = "usd"; insuredvaluetype.monetaryvalue = "65.75"; packservtype.declaredvalue = insuredvaluetype; upsratews.shipperdeclaredvaluetype shipperdeclaredvaluetype = new upsratews.shipperdeclaredvaluetype(); shipperdeclaredvaluetype.currencycode = "usd"; shipperdeclaredvaluetype.monetaryvalue = "65.75"; packservtype.shipperdeclaredvalue = shipperdeclaredvaluetype; package.packageserviceoptions = packservtype; upsratews.packagetype[] pkgarray = { package }; shipment.package = pkgarray; raterequest.shipment = shipment; upsratews.codedescriptiontype pickuptype = new upsratews.codedescriptiontype(); pickuptype.code = "01"; pickuptype.description = "daily pickup"; raterequest.pickuptype = pickuptype; upsratews.rateresponse rateresponse = myrateporttypeclient.processrate(upss, raterequest);
Comments
Post a Comment