locked
UPS Time in Transit (TNT) API integration with asp.net RRS feed

  • Question

  • User552255588 posted

    Good day all... been killing my self over this. Not much on the internet either so its either super easy or no one is doing it. Yet I am having this issue. 

    Debugging I can capture the return service data and view each Service type. See here: 

    But I cannot get to it in the code. You would assume you should be able to do this: 

    foreach (ServiceSummaryType UPSServiceSum in tntResponse.Item.ServiceSumarry)

    but I get compiler error: "object" does not contain definition for ServiceSumarry... 

    Main question how do I get this data out if I cannot access it! 

    Monday, September 19, 2016 5:42 PM

Answers

  • User552255588 posted

    Solved. I took the Item object to a string and learned that it is of type TransitResponseType. UPSTimeInTransit is my name for the web reference imported from UPS's wsdl file. 

    UPSTimeInTransit.TransitResponseType TNTResponseType = (UPSTimeInTransit.TransitResponseType)tntResponse.Item; 
                    
                    foreach (UPSTimeInTransit.ServiceSummaryType UPSServiceType in TNTResponseType.ServiceSummary)
                    {
                        ResultsTimeInTransitNewRow = ResultsTimeInTransit.NewRow();
                        ResultsTimeInTransitNewRow[0] = UPSServiceType.Service.Description;
                        ResultsTimeInTransitNewRow[1] = DateTime.ParseExact(UPSServiceType.EstimatedArrival.Arrival.Date + UPSServiceType.EstimatedArrival.Arrival.Time ?? "235959", "yyyyMMddHHmmss", CultureInfo.CurrentCulture);
                        ResultsTimeInTransitNewRow[2] = DateTime.ParseExact(UPSServiceType.EstimatedArrival.Arrival.Date + UPSServiceType.EstimatedArrival.Arrival.Time ?? "235959", "yyyyMMddHHmmss", CultureInfo.CurrentCulture);
                        ResultsTimeInTransit.Rows.Add(ResultsTimeInTransitNewRow); 
                    }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 20, 2016 6:27 PM