Sample code for 30+ languages & platforms
AutoIt

UPS Rate Request

See more UPS Examples

Simple UPS Rate Example

Chilkat AutoIt Downloads

AutoIt
Local $bSuccess = False

;  This example assumes the Chilkat API to have been previously unlocked.
;  See Global Unlock Sample for sample code.

$oHttp = ObjCreate("Chilkat.Http")

;  Use this online tool to generate code from sample JSON:
;  Generate Code to Create JSON

;  The following JSON is sent in the request body.

;  {
;    "RateRequest": {
;      "Request": {
;        "TransactionReference": {
;          "CustomerContext": "CustomerContext"
;        }
;      },
;      "Shipment": {
;        "Shipper": {
;          "Name": "ShipperName",
;          "ShipperNumber": "ShipperNumber",
;          "Address": {
;            "AddressLine": [
;              "ShipperAddressLine",
;              "ShipperAddressLine",
;              "ShipperAddressLine"
;            ],
;            "City": "TIMONIUM",
;            "StateProvinceCode": "MD",
;            "PostalCode": "21093",
;            "CountryCode": "US"
;          }
;        },
;        "ShipTo": {
;          "Name": "ShipToName",
;          "Address": {
;            "AddressLine": [
;              "ShipToAddressLine",
;              "ShipToAddressLine",
;              "ShipToAddressLine"
;            ],
;            "City": "Alpharetta",
;            "StateProvinceCode": "GA",
;            "PostalCode": "30005",
;            "CountryCode": "US"
;          }
;        },
;        "ShipFrom": {
;          "Name": "ShipFromName",
;          "Address": {
;            "AddressLine": [
;              "ShipFromAddressLine",
;              "ShipFromAddressLine",
;              "ShipFromAddressLine"
;            ],
;            "City": "TIMONIUM",
;            "StateProvinceCode": "MD",
;            "PostalCode": "21093",
;            "CountryCode": "US"
;          }
;        },
;        "PaymentDetails": {
;          "ShipmentCharge": {
;            "Type": "01",
;            "BillShipper": {
;              "AccountNumber": "ShipperNumber"
;            }
;          }
;        },
;        "Service": {
;          "Code": "03",
;          "Description": "Ground"
;        },
;        "NumOfPieces": "1",
;        "Package": {
;          "PackagingType": {
;            "Code": "02",
;            "Description": "Packaging"
;          },
;          "Dimensions": {
;            "UnitOfMeasurement": {
;              "Code": "IN",
;              "Description": "Inches"
;            },
;            "Length": "5",
;            "Width": "5",
;            "Height": "5"
;          },
;          "PackageWeight": {
;            "UnitOfMeasurement": {
;              "Code": "LBS",
;              "Description": "Pounds"
;            },
;            "Weight": "1"
;          }
;        }
;      }
;    }
;  }

$oJson = ObjCreate("Chilkat.JsonObject")
$oJson.UpdateString("RateRequest.Request.TransactionReference.CustomerContext","CustomerContext")
$oJson.UpdateString("RateRequest.Shipment.Shipper.Name","ShipperName")
$oJson.UpdateString("RateRequest.Shipment.Shipper.ShipperNumber","ShipperNumber")
$oJson.UpdateString("RateRequest.Shipment.Shipper.Address.AddressLine[0]","ShipperAddressLine")
$oJson.UpdateString("RateRequest.Shipment.Shipper.Address.AddressLine[1]","ShipperAddressLine")
$oJson.UpdateString("RateRequest.Shipment.Shipper.Address.AddressLine[2]","ShipperAddressLine")
$oJson.UpdateString("RateRequest.Shipment.Shipper.Address.City","TIMONIUM")
$oJson.UpdateString("RateRequest.Shipment.Shipper.Address.StateProvinceCode","MD")
$oJson.UpdateString("RateRequest.Shipment.Shipper.Address.PostalCode","21093")
$oJson.UpdateString("RateRequest.Shipment.Shipper.Address.CountryCode","US")
$oJson.UpdateString("RateRequest.Shipment.ShipTo.Name","ShipToName")
$oJson.UpdateString("RateRequest.Shipment.ShipTo.Address.AddressLine[0]","ShipToAddressLine")
$oJson.UpdateString("RateRequest.Shipment.ShipTo.Address.AddressLine[1]","ShipToAddressLine")
$oJson.UpdateString("RateRequest.Shipment.ShipTo.Address.AddressLine[2]","ShipToAddressLine")
$oJson.UpdateString("RateRequest.Shipment.ShipTo.Address.City","Alpharetta")
$oJson.UpdateString("RateRequest.Shipment.ShipTo.Address.StateProvinceCode","GA")
$oJson.UpdateString("RateRequest.Shipment.ShipTo.Address.PostalCode","30005")
$oJson.UpdateString("RateRequest.Shipment.ShipTo.Address.CountryCode","US")
$oJson.UpdateString("RateRequest.Shipment.ShipFrom.Name","ShipFromName")
$oJson.UpdateString("RateRequest.Shipment.ShipFrom.Address.AddressLine[0]","ShipFromAddressLine")
$oJson.UpdateString("RateRequest.Shipment.ShipFrom.Address.AddressLine[1]","ShipFromAddressLine")
$oJson.UpdateString("RateRequest.Shipment.ShipFrom.Address.AddressLine[2]","ShipFromAddressLine")
$oJson.UpdateString("RateRequest.Shipment.ShipFrom.Address.City","TIMONIUM")
$oJson.UpdateString("RateRequest.Shipment.ShipFrom.Address.StateProvinceCode","MD")
$oJson.UpdateString("RateRequest.Shipment.ShipFrom.Address.PostalCode","21093")
$oJson.UpdateString("RateRequest.Shipment.ShipFrom.Address.CountryCode","US")
$oJson.UpdateString("RateRequest.Shipment.PaymentDetails.ShipmentCharge.Type","01")
$oJson.UpdateString("RateRequest.Shipment.PaymentDetails.ShipmentCharge.BillShipper.AccountNumber","ShipperNumber")
$oJson.UpdateString("RateRequest.Shipment.Service.Code","03")
$oJson.UpdateString("RateRequest.Shipment.Service.Description","Ground")
$oJson.UpdateString("RateRequest.Shipment.NumOfPieces","1")
$oJson.UpdateString("RateRequest.Shipment.Package.PackagingType.Code","02")
$oJson.UpdateString("RateRequest.Shipment.Package.PackagingType.Description","Packaging")
$oJson.UpdateString("RateRequest.Shipment.Package.Dimensions.UnitOfMeasurement.Code","IN")
$oJson.UpdateString("RateRequest.Shipment.Package.Dimensions.UnitOfMeasurement.Description","Inches")
$oJson.UpdateString("RateRequest.Shipment.Package.Dimensions.Length","5")
$oJson.UpdateString("RateRequest.Shipment.Package.Dimensions.Width","5")
$oJson.UpdateString("RateRequest.Shipment.Package.Dimensions.Height","5")
$oJson.UpdateString("RateRequest.Shipment.Package.PackageWeight.UnitOfMeasurement.Code","LBS")
$oJson.UpdateString("RateRequest.Shipment.Package.PackageWeight.UnitOfMeasurement.Description","Pounds")
$oJson.UpdateString("RateRequest.Shipment.Package.PackageWeight.Weight","1")

;  Load the OAuth2 access token obtained via client credentials as shown 
;  in this UPS OAuth2 Client Credentials example.

$oJsonToken = ObjCreate("Chilkat.JsonObject")
$bSuccess = $oJsonToken.LoadFile("qa_data/tokens/ups_oauth2_token.json")
If ($bSuccess <> True) Then
    ConsoleWrite("Failed to load ups_oauth2_token.json" & @CRLF)
    Exit
EndIf

;  The access token JSON looks something like this:

;  {
;    "token_type": "Bearer",
;    "issued_at": "1686911985606",
;    "client_id": "2498righ8wr6aihe98rt8rhowirtyw9er6twe80rtywrehrt",
;    "access_token": "eyJraW......R2sbqrY",
;    "expires_in": "14399",
;    "status": "approved"
;  }

;  Adds the "Authorization: Bearer <YOUR_TOKEN_HERE>" header.
$oHttp.AuthToken = $oJsonToken.StringOf("access_token")
$oHttp.SetRequestHeader "Content-Type","application/json"
$oHttp.SetRequestHeader "transId","string"
$oHttp.SetRequestHeader "transactionSrc","testing"

;  The "version" indicates Rate API to display the new release features in Rate API response based on Rate release.
;  Supported values: v1, v1601, v1607, v1701, v1707, v2108, v2205.
$oHttp.SetUrlVar("version","v1")

;  The "requestoption" has the following valid values:
;  Rate = The server rates (The default Request option is Rate if a Request Option is not provided). 
;  Shop = The server validates the shipment, and returns rates for all UPS products from the ShipFrom to the ShipTo addresses. 
;  Rate is the only valid request option for Ground Freight Pricing requests.
$oHttp.SetUrlVar("requestoption","Rate")

$oResp = ObjCreate("Chilkat.HttpResponse")
$bSuccess = $oHttp.HttpJson("POST","https://wwwcie.ups.com/api/rating/{$version}/{$requestoption}?additionalinfo=string",$oJson,"application/json",$oResp)
If ($bSuccess = False) Then
    ConsoleWrite($oHttp.LastErrorText & @CRLF)
    Exit
EndIf

$oSbResponseBody = ObjCreate("Chilkat.StringBuilder")
$oResp.GetBodySb($oSbResponseBody)

$oJResp = ObjCreate("Chilkat.JsonObject")
$oJResp.LoadSb($oSbResponseBody)
$oJResp.EmitCompact = False

ConsoleWrite("Response Body:" & @CRLF)
ConsoleWrite($oJResp.Emit() & @CRLF)

;  ----------------------------------------------------------------------------------------------------------
;  Important: If you get the following error response, read further for the solution..
;  
;  {
;    "response": {
;      "errors": [
;        {
;          "code": "250002",
;          "message": "Invalid Authentication Information."
;        }
;      ]
;    }
;  }
;  
;  It means you didn't add the Rating API permission to your app.
;  To add the Rating API, login to your developer account and go to your Apps page at https://developer.ups.com/apps?loc=en_US
;  Then edit your app and add the Rating API.
;  ----------------------------------------------------------------------------------------------------------

Local $iRespStatusCode = $oResp.StatusCode
ConsoleWrite("Response Status Code = " & $iRespStatusCode & @CRLF)
If ($iRespStatusCode >= 400) Then
    ConsoleWrite("Response Header:" & @CRLF)
    ConsoleWrite($oResp.Header & @CRLF)
    ConsoleWrite("Failed." & @CRLF)
    Exit
EndIf

;  Sample JSON response:
;  (Sample code for parsing the JSON response is shown below)

;  {
;    "RateResponse": {
;      "Response": {
;        "ResponseStatus": {
;          "Code": "s",
;          "Description": "string"
;        },
;        "Alert": [
;          {
;            "Code": "string",
;            "Description": "string"
;          }
;        ],
;        "AlertDetail": [
;          {
;            "Code": "string",
;            "Description": "string",
;            "ElementLevelInformation": {
;              "Level": "s",
;              "ElementIdentifier": [
;                {
;                  "Code": null,
;                  "Value": null
;                }
;              ]
;            }
;          }
;        ],
;        "TransactionReference": {
;          "CustomerContext": "string"
;        }
;      },
;      "RatedShipment": [
;        {
;          "Disclaimer": [
;            {
;              "Code": "st",
;              "Description": "string"
;            }
;          ],
;          "Service": {
;            "Code": "str",
;            "Description": "string"
;          },
;          "RateChart": "s",
;          "RatedShipmentAlert": [
;            {
;              "Code": "string",
;              "Description": "string"
;            }
;          ],
;          "BillableWeightCalculationMethod": "st",
;          "RatingMethod": "st",
;          "BillingWeight": {
;            "UnitOfMeasurement": {
;              "Code": "str",
;              "Description": "string"
;            },
;            "Weight": "strin"
;          },
;          "TransportationCharges": {
;            "CurrencyCode": "str",
;            "MonetaryValue": "stringstringstri"
;          },
;          "BaseServiceCharge": {
;            "CurrencyCode": "str",
;            "MonetaryValue": "stringstringstri"
;          },
;          "ItemizedCharges": [
;            {
;              "Code": "str",
;              "Description": "string",
;              "CurrencyCode": "str",
;              "MonetaryValue": "string",
;              "SubType": "string"
;            }
;          ],
;          "FRSShipmentData": {
;            "TransportationCharges": {
;              "GrossCharge": {
;                "CurrencyCode": "str",
;                "MonetaryValue": "string"
;              },
;              "DiscountAmount": {
;                "CurrencyCode": "str",
;                "MonetaryValue": "string"
;              },
;              "DiscountPercentage": "st",
;              "NetCharge": {
;                "CurrencyCode": "str",
;                "MonetaryValue": "string"
;              }
;            },
;            "FreightDensityRate": {
;              "Density": "strin",
;              "TotalCubicFeet": "string"
;            },
;            "HandlingUnits": [
;              {
;                "Quantity": "string",
;                "Type": {
;                  "Code": null,
;                  "Description": null
;                },
;                "Dimensions": {
;                  "UnitOfMeasurement": null,
;                  "Length": null,
;                  "Width": null,
;                  "Height": null
;                },
;                "AdjustedHeight": {
;                  "Value": null,
;                  "UnitOfMeasurement": null
;                }
;              }
;            ]
;          },
;          "ServiceOptionsCharges": {
;            "CurrencyCode": "str",
;            "MonetaryValue": "string"
;          },
;          "TaxCharges": [
;            {
;              "Type": "string",
;              "MonetaryValue": "string"
;            }
;          ],
;          "TotalCharges": {
;            "CurrencyCode": "str",
;            "MonetaryValue": "string"
;          },
;          "TotalChargesWithTaxes": {
;            "CurrencyCode": "str",
;            "MonetaryValue": "string"
;          },
;          "NegotiatedRateCharges": {
;            "ItemizedCharges": [
;              {
;                "Code": "str",
;                "Description": "string",
;                "CurrencyCode": "str",
;                "MonetaryValue": "string",
;                "SubType": "string"
;              }
;            ],
;            "TaxCharges": [
;              {
;                "Type": "string",
;                "MonetaryValue": "string"
;              }
;            ],
;            "TotalCharge": {
;              "CurrencyCode": "string",
;              "MonetaryValue": "string"
;            },
;            "TotalChargesWithTaxes": {
;              "CurrencyCode": "string",
;              "MonetaryValue": "string"
;            }
;          },
;          "RatedPackage": [
;            {
;              "BaseServiceCharge": {
;                "CurrencyCode": "str",
;                "MonetaryValue": "string"
;              },
;              "TransportationCharges": {
;                "CurrencyCode": "string",
;                "MonetaryValue": "string"
;              },
;              "ServiceOptionsCharges": {
;                "CurrencyCode": "string",
;                "MonetaryValue": "string"
;              },
;              "TotalCharges": {
;                "CurrencyCode": "string",
;                "MonetaryValue": "string"
;              },
;              "Weight": "string",
;              "BillingWeight": {
;                "UnitOfMeasurement": {
;                  "Code": null,
;                  "Description": null
;                },
;                "Weight": "string"
;              },
;              "Accessorial": [
;                {
;                  "Code": null,
;                  "Description": null
;                }
;              ],
;              "ItemizedCharges": [
;                {
;                  "Code": null,
;                  "Description": null,
;                  "CurrencyCode": null,
;                  "MonetaryValue": null,
;                  "SubType": null
;                }
;              ],
;              "NegotiatedCharges": {
;                "ItemizedCharges": [
;                  null
;                ]
;              },
;              "SimpleRate": {
;                "Code": "st"
;              },
;              "RateModifier": [
;                {
;                  "ModifierType": null,
;                  "ModifierDesc": null,
;                  "Amount": null
;                }
;              ]
;            }
;          ],
;          "TimeInTransit": {
;            "PickupDate": "stringst",
;            "DocumentsOnlyIndicator": "string",
;            "PackageBillType": "st",
;            "ServiceSummary": {
;              "Service": {
;                "Description": "string"
;              },
;              "GuaranteedIndicator": "string",
;              "Disclaimer": "string",
;              "EstimatedArrival": {
;                "Arrival": {
;                  "Date": null,
;                  "Time": null
;                },
;                "BusinessDaysInTransit": "strin",
;                "Pickup": {
;                  "Date": null,
;                  "Time": null
;                },
;                "DayOfWeek": "string",
;                "CustomerCenterCutoff": "string",
;                "DelayCount": "str",
;                "HolidayCount": "st",
;                "RestDays": "st",
;                "TotalTransitDays": "strin"
;              },
;              "SaturdayDelivery": "string",
;              "SaturdayDeliveryDisclaimer": "string",
;              "SundayDelivery": "string",
;              "SundayDeliveryDisclaimer": "string"
;            },
;            "AutoDutyCode": "st",
;            "Disclaimer": "string"
;          },
;          "ScheduledDeliveryDate": "string",
;          "RoarRatedIndicator": "string"
;        }
;      ]
;    }
;  }

;  Sample code for parsing the JSON response...
;  Use the following online tool to generate parsing code from sample JSON:
;  Generate Parsing Code from JSON

Local $sLevel
Local $iJ
Local $iCount_j
Local $sValue
Local $sServiceCode
Local $sServiceDescription
Local $sRateChart
Local $sBillableWeightCalculationMethod
Local $sRatingMethod
Local $sUnitOfMeasurementCode
Local $sUnitOfMeasurementDescription
Local $sWeight
Local $sCurrencyCode
Local $sMonetaryValue
Local $sBaseServiceChargeCurrencyCode
Local $sBaseServiceChargeMonetaryValue
Local $sGrossChargeCurrencyCode
Local $sGrossChargeMonetaryValue
Local $sDiscountAmountCurrencyCode
Local $sDiscountAmountMonetaryValue
Local $sDiscountPercentage
Local $sNetChargeCurrencyCode
Local $sNetChargeMonetaryValue
Local $sDensity
Local $sTotalCubicFeet
Local $sServiceOptionsChargesCurrencyCode
Local $sServiceOptionsChargesMonetaryValue
Local $sTotalChargesCurrencyCode
Local $sTotalChargesMonetaryValue
Local $sTotalChargesWithTaxesCurrencyCode
Local $sTotalChargesWithTaxesMonetaryValue
Local $sTotalChargeCurrencyCode
Local $sTotalChargeMonetaryValue
Local $sPickupDate
Local $sDocumentsOnlyIndicator
Local $sPackageBillType
Local $sGuaranteedIndicator
Local $sDisclaimer
Local $sDate
Local $sTime
Local $sBusinessDaysInTransit
Local $sPickupTime
Local $sDayOfWeek
Local $sCustomerCenterCutoff
Local $sDelayCount
Local $sHolidayCount
Local $sRestDays
Local $sTotalTransitDays
Local $sSaturdayDelivery
Local $sSaturdayDeliveryDisclaimer
Local $sSundayDelivery
Local $sSundayDeliveryDisclaimer
Local $sAutoDutyCode
Local $sTimeInTransitDisclaimer
Local $sScheduledDeliveryDate
Local $sRoarRatedIndicator
Local $sSubType
Local $sQuantity
Local $sTypeCode
Local $sTypeDescription
Local $sUnitOfMeasurement
Local $sLength
Local $sWidth
Local $sHeight
Local $sAdjustedHeightValue
Local $sAdjustedHeightUnitOfMeasurement
Local $sV_Type
Local $sTransportationChargesCurrencyCode
Local $sTransportationChargesMonetaryValue
Local $sBillingWeightWeight
Local $sSimpleRateCode
Local $iK
Local $iCount_k
Local $bNullVal
Local $sModifierType
Local $sModifierDesc
Local $sAmount

Local $sCode = $oJResp.StringOf("RateResponse.Response.ResponseStatus.Code")
Local $sDescription = $oJResp.StringOf("RateResponse.Response.ResponseStatus.Description")
Local $sCustomerContext = $oJResp.StringOf("RateResponse.Response.TransactionReference.CustomerContext")
Local $i = 0
Local $iCount_i = $oJResp.SizeOfArray("RateResponse.Response.Alert")
While $i < $iCount_i
    $oJResp.I = $i
    $sCode = $oJResp.StringOf("RateResponse.Response.Alert[i].Code")
    $sDescription = $oJResp.StringOf("RateResponse.Response.Alert[i].Description")
    $i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("RateResponse.Response.AlertDetail")
While $i < $iCount_i
    $oJResp.I = $i
    $sCode = $oJResp.StringOf("RateResponse.Response.AlertDetail[i].Code")
    $sDescription = $oJResp.StringOf("RateResponse.Response.AlertDetail[i].Description")
    $sLevel = $oJResp.StringOf("RateResponse.Response.AlertDetail[i].ElementLevelInformation.Level")
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("RateResponse.Response.AlertDetail[i].ElementLevelInformation.ElementIdentifier")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $sCode = $oJResp.StringOf("RateResponse.Response.AlertDetail[i].ElementLevelInformation.ElementIdentifier[j].Code")
        $sValue = $oJResp.StringOf("RateResponse.Response.AlertDetail[i].ElementLevelInformation.ElementIdentifier[j].Value")
        $iJ = $iJ + 1
    Wend
    $i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("RateResponse.RatedShipment")
While $i < $iCount_i
    $oJResp.I = $i
    $sServiceCode = $oJResp.StringOf("RateResponse.RatedShipment[i].Service.Code")
    $sServiceDescription = $oJResp.StringOf("RateResponse.RatedShipment[i].Service.Description")
    $sRateChart = $oJResp.StringOf("RateResponse.RatedShipment[i].RateChart")
    $sBillableWeightCalculationMethod = $oJResp.StringOf("RateResponse.RatedShipment[i].BillableWeightCalculationMethod")
    $sRatingMethod = $oJResp.StringOf("RateResponse.RatedShipment[i].RatingMethod")
    $sUnitOfMeasurementCode = $oJResp.StringOf("RateResponse.RatedShipment[i].BillingWeight.UnitOfMeasurement.Code")
    $sUnitOfMeasurementDescription = $oJResp.StringOf("RateResponse.RatedShipment[i].BillingWeight.UnitOfMeasurement.Description")
    $sWeight = $oJResp.StringOf("RateResponse.RatedShipment[i].BillingWeight.Weight")
    $sCurrencyCode = $oJResp.StringOf("RateResponse.RatedShipment[i].TransportationCharges.CurrencyCode")
    $sMonetaryValue = $oJResp.StringOf("RateResponse.RatedShipment[i].TransportationCharges.MonetaryValue")
    $sBaseServiceChargeCurrencyCode = $oJResp.StringOf("RateResponse.RatedShipment[i].BaseServiceCharge.CurrencyCode")
    $sBaseServiceChargeMonetaryValue = $oJResp.StringOf("RateResponse.RatedShipment[i].BaseServiceCharge.MonetaryValue")
    $sGrossChargeCurrencyCode = $oJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.GrossCharge.CurrencyCode")
    $sGrossChargeMonetaryValue = $oJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.GrossCharge.MonetaryValue")
    $sDiscountAmountCurrencyCode = $oJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.DiscountAmount.CurrencyCode")
    $sDiscountAmountMonetaryValue = $oJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.DiscountAmount.MonetaryValue")
    $sDiscountPercentage = $oJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.DiscountPercentage")
    $sNetChargeCurrencyCode = $oJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.NetCharge.CurrencyCode")
    $sNetChargeMonetaryValue = $oJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.TransportationCharges.NetCharge.MonetaryValue")
    $sDensity = $oJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.FreightDensityRate.Density")
    $sTotalCubicFeet = $oJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.FreightDensityRate.TotalCubicFeet")
    $sServiceOptionsChargesCurrencyCode = $oJResp.StringOf("RateResponse.RatedShipment[i].ServiceOptionsCharges.CurrencyCode")
    $sServiceOptionsChargesMonetaryValue = $oJResp.StringOf("RateResponse.RatedShipment[i].ServiceOptionsCharges.MonetaryValue")
    $sTotalChargesCurrencyCode = $oJResp.StringOf("RateResponse.RatedShipment[i].TotalCharges.CurrencyCode")
    $sTotalChargesMonetaryValue = $oJResp.StringOf("RateResponse.RatedShipment[i].TotalCharges.MonetaryValue")
    $sTotalChargesWithTaxesCurrencyCode = $oJResp.StringOf("RateResponse.RatedShipment[i].TotalChargesWithTaxes.CurrencyCode")
    $sTotalChargesWithTaxesMonetaryValue = $oJResp.StringOf("RateResponse.RatedShipment[i].TotalChargesWithTaxes.MonetaryValue")
    $sTotalChargeCurrencyCode = $oJResp.StringOf("RateResponse.RatedShipment[i].NegotiatedRateCharges.TotalCharge.CurrencyCode")
    $sTotalChargeMonetaryValue = $oJResp.StringOf("RateResponse.RatedShipment[i].NegotiatedRateCharges.TotalCharge.MonetaryValue")
    $sTotalChargesWithTaxesCurrencyCode = $oJResp.StringOf("RateResponse.RatedShipment[i].NegotiatedRateCharges.TotalChargesWithTaxes.CurrencyCode")
    $sTotalChargesWithTaxesMonetaryValue = $oJResp.StringOf("RateResponse.RatedShipment[i].NegotiatedRateCharges.TotalChargesWithTaxes.MonetaryValue")
    $sPickupDate = $oJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.PickupDate")
    $sDocumentsOnlyIndicator = $oJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.DocumentsOnlyIndicator")
    $sPackageBillType = $oJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.PackageBillType")
    $sServiceDescription = $oJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.Service.Description")
    $sGuaranteedIndicator = $oJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.GuaranteedIndicator")
    $sDisclaimer = $oJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.Disclaimer")
    $sDate = $oJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.Arrival.Date")
    $sTime = $oJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.Arrival.Time")
    $sBusinessDaysInTransit = $oJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.BusinessDaysInTransit")
    $sPickupDate = $oJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.Pickup.Date")
    $sPickupTime = $oJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.Pickup.Time")
    $sDayOfWeek = $oJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.DayOfWeek")
    $sCustomerCenterCutoff = $oJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.CustomerCenterCutoff")
    $sDelayCount = $oJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.DelayCount")
    $sHolidayCount = $oJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.HolidayCount")
    $sRestDays = $oJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.RestDays")
    $sTotalTransitDays = $oJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.EstimatedArrival.TotalTransitDays")
    $sSaturdayDelivery = $oJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.SaturdayDelivery")
    $sSaturdayDeliveryDisclaimer = $oJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.SaturdayDeliveryDisclaimer")
    $sSundayDelivery = $oJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.SundayDelivery")
    $sSundayDeliveryDisclaimer = $oJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.ServiceSummary.SundayDeliveryDisclaimer")
    $sAutoDutyCode = $oJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.AutoDutyCode")
    $sTimeInTransitDisclaimer = $oJResp.StringOf("RateResponse.RatedShipment[i].TimeInTransit.Disclaimer")
    $sScheduledDeliveryDate = $oJResp.StringOf("RateResponse.RatedShipment[i].ScheduledDeliveryDate")
    $sRoarRatedIndicator = $oJResp.StringOf("RateResponse.RatedShipment[i].RoarRatedIndicator")
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("RateResponse.RatedShipment[i].Disclaimer")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $sCode = $oJResp.StringOf("RateResponse.RatedShipment[i].Disclaimer[j].Code")
        $sDescription = $oJResp.StringOf("RateResponse.RatedShipment[i].Disclaimer[j].Description")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("RateResponse.RatedShipment[i].RatedShipmentAlert")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $sCode = $oJResp.StringOf("RateResponse.RatedShipment[i].RatedShipmentAlert[j].Code")
        $sDescription = $oJResp.StringOf("RateResponse.RatedShipment[i].RatedShipmentAlert[j].Description")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("RateResponse.RatedShipment[i].ItemizedCharges")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $sCode = $oJResp.StringOf("RateResponse.RatedShipment[i].ItemizedCharges[j].Code")
        $sDescription = $oJResp.StringOf("RateResponse.RatedShipment[i].ItemizedCharges[j].Description")
        $sCurrencyCode = $oJResp.StringOf("RateResponse.RatedShipment[i].ItemizedCharges[j].CurrencyCode")
        $sMonetaryValue = $oJResp.StringOf("RateResponse.RatedShipment[i].ItemizedCharges[j].MonetaryValue")
        $sSubType = $oJResp.StringOf("RateResponse.RatedShipment[i].ItemizedCharges[j].SubType")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $sQuantity = $oJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Quantity")
        $sTypeCode = $oJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Type.Code")
        $sTypeDescription = $oJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Type.Description")
        $sUnitOfMeasurement = $oJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.UnitOfMeasurement")
        $sLength = $oJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.Length")
        $sWidth = $oJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.Width")
        $sHeight = $oJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].Dimensions.Height")
        $sAdjustedHeightValue = $oJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].AdjustedHeight.Value")
        $sAdjustedHeightUnitOfMeasurement = $oJResp.StringOf("RateResponse.RatedShipment[i].FRSShipmentData.HandlingUnits[j].AdjustedHeight.UnitOfMeasurement")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("RateResponse.RatedShipment[i].TaxCharges")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $sV_Type = $oJResp.StringOf("RateResponse.RatedShipment[i].TaxCharges[j].Type")
        $sMonetaryValue = $oJResp.StringOf("RateResponse.RatedShipment[i].TaxCharges[j].MonetaryValue")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $sCode = $oJResp.StringOf("RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].Code")
        $sDescription = $oJResp.StringOf("RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].Description")
        $sCurrencyCode = $oJResp.StringOf("RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].CurrencyCode")
        $sMonetaryValue = $oJResp.StringOf("RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].MonetaryValue")
        $sSubType = $oJResp.StringOf("RateResponse.RatedShipment[i].NegotiatedRateCharges.ItemizedCharges[j].SubType")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("RateResponse.RatedShipment[i].NegotiatedRateCharges.TaxCharges")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $sV_Type = $oJResp.StringOf("RateResponse.RatedShipment[i].NegotiatedRateCharges.TaxCharges[j].Type")
        $sMonetaryValue = $oJResp.StringOf("RateResponse.RatedShipment[i].NegotiatedRateCharges.TaxCharges[j].MonetaryValue")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("RateResponse.RatedShipment[i].RatedPackage")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $sBaseServiceChargeCurrencyCode = $oJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].BaseServiceCharge.CurrencyCode")
        $sBaseServiceChargeMonetaryValue = $oJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].BaseServiceCharge.MonetaryValue")
        $sTransportationChargesCurrencyCode = $oJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].TransportationCharges.CurrencyCode")
        $sTransportationChargesMonetaryValue = $oJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].TransportationCharges.MonetaryValue")
        $sServiceOptionsChargesCurrencyCode = $oJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].ServiceOptionsCharges.CurrencyCode")
        $sServiceOptionsChargesMonetaryValue = $oJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].ServiceOptionsCharges.MonetaryValue")
        $sTotalChargesCurrencyCode = $oJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].TotalCharges.CurrencyCode")
        $sTotalChargesMonetaryValue = $oJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].TotalCharges.MonetaryValue")
        $sWeight = $oJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].Weight")
        $sUnitOfMeasurementCode = $oJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].BillingWeight.UnitOfMeasurement.Code")
        $sUnitOfMeasurementDescription = $oJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].BillingWeight.UnitOfMeasurement.Description")
        $sBillingWeightWeight = $oJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].BillingWeight.Weight")
        $sSimpleRateCode = $oJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].SimpleRate.Code")
        $iK = 0
        $iCount_k = $oJResp.SizeOfArray("RateResponse.RatedShipment[i].RatedPackage[j].Accessorial")
        While $iK < $iCount_k
            $oJResp.K = $iK
            $sCode = $oJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].Accessorial[k].Code")
            $sDescription = $oJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].Accessorial[k].Description")
            $iK = $iK + 1
        Wend
        $iK = 0
        $iCount_k = $oJResp.SizeOfArray("RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges")
        While $iK < $iCount_k
            $oJResp.K = $iK
            $sCode = $oJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].Code")
            $sDescription = $oJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].Description")
            $sCurrencyCode = $oJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].CurrencyCode")
            $sMonetaryValue = $oJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].MonetaryValue")
            $sSubType = $oJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].ItemizedCharges[k].SubType")
            $iK = $iK + 1
        Wend
        $iK = 0
        $iCount_k = $oJResp.SizeOfArray("RateResponse.RatedShipment[i].RatedPackage[j].NegotiatedCharges.ItemizedCharges")
        While $iK < $iCount_k
            $oJResp.K = $iK
            $bNullVal = $oJResp.IsNullOf("RateResponse.RatedShipment[i].RatedPackage[j].NegotiatedCharges.ItemizedCharges[k]")
            $iK = $iK + 1
        Wend
        $iK = 0
        $iCount_k = $oJResp.SizeOfArray("RateResponse.RatedShipment[i].RatedPackage[j].RateModifier")
        While $iK < $iCount_k
            $oJResp.K = $iK
            $sModifierType = $oJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].RateModifier[k].ModifierType")
            $sModifierDesc = $oJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].RateModifier[k].ModifierDesc")
            $sAmount = $oJResp.StringOf("RateResponse.RatedShipment[i].RatedPackage[j].RateModifier[k].Amount")
            $iK = $iK + 1
        Wend
        $iJ = $iJ + 1
    Wend
    $i = $i + 1
Wend