I'm looking to cache all Fedex tracking information in my own database, and my company has around 150+ tracking numbers a day. According to this link...
http://www.fedex.com/us/developer/product/WebServices/MyWebHelp_August2010/Content/Proprietary_Developer_Guide/tTracking_and_Visibility_Services_condtionalized.htm
Fedex services do not support batch processing..? Does that mean I'd need to do single calls for every tracking number? I took about 80 seconds for one days worth of sales doing it that way...
Is there no better option currently? Or is there a better way or process for doing this?
Yes, you need to send each track as a separate request. Run it as a server-side process via a schedule, who cares how long it takes then!?
Use This Code Hope It Will Help You
TrackRequest request = CreateFedexMultipleTrackRequest(TrackingCode);
TrackService service = new TrackService();
TrackReply reply = service.track(request);
if (reply.HighestSeverity == NotificationSeverityType.SUCCESS || reply.HighestSeverity == NotificationSeverityType.NOTE || reply.HighestSeverity == NotificationSeverityType.WARNING)
{
reply.CompletedTrackDetails//now manage All tracking As Your Need
}
//go to How to create single request for multiple tracking numbers at a time
private static TrackRequest CreateFedexMultipleTrackRequest(string TrackingNumber)
{
//string[] str = new string[] {TrackingNumber};
string[] staticIntArray = TrackingNumber.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
//int arraycount = staticIntArray.Count();
TrackRequest request = new TrackRequest();
request.WebAuthenticationDetail = new WebAuthenticationDetail();
request.WebAuthenticationDetail.UserCredential = new WebAuthenticationCredential();
request.WebAuthenticationDetail.UserCredential.Key = Application.FedexKey;
request.WebAuthenticationDetail.UserCredential.Password = Application.FedexPassword;
request.WebAuthenticationDetail.ParentCredential = new WebAuthenticationCredential();
request.WebAuthenticationDetail.ParentCredential.Key = Application.FedexKey;
request.WebAuthenticationDetail.ParentCredential.Password = Application.FedexPassword;
request.ClientDetail = new ClientDetail();
request.ClientDetail.AccountNumber = Application.FedexAccountNumber;
request.ClientDetail.MeterNumber = Application.FedexMeterNumber;
request.TransactionDetail = new TransactionDetail();
request.TransactionDetail.CustomerTransactionId = "NA"; //This is a reference field for the customer. Any value can be used and will be provided in the response.
request.Version = new VersionId();
// Tracking information
request.SelectionDetails = new TrackSelectionDetail[staticIntArray.Length];
for (int j = 0; j <= staticIntArray.Length - 1; j++) { request.SelectionDetails[j] = new TrackSelectionDetail(); }
for (int i = 0; i <= staticIntArray.Length - 1; i++)
{
request.SelectionDetails[i].PackageIdentifier = new TrackPackageIdentifier();
request.SelectionDetails[i].PackageIdentifier.Value = staticIntArray[i]; //tracking number or door tag
request.SelectionDetails[i].PackageIdentifier.Type = TrackIdentifierType.DOCUMENT_AIRWAY_BILL;
request.SelectionDetails[i].ShipmentAccountNumber = "XXX";
// Date range is optional.
// If omitted, set to false
request.SelectionDetails[i].ShipDateRangeBegin = DateTime.Parse("05/09/2016"); //MM/DD/YYYY
request.SelectionDetails[i].ShipDateRangeEnd = request.SelectionDetails[0].ShipDateRangeBegin.AddDays(0);
request.SelectionDetails[i].ShipDateRangeBeginSpecified = true;
request.SelectionDetails[i].ShipDateRangeEndSpecified = true;
}
// Include detailed scans is optional.
// If omitted, set to false
request.ProcessingOptions = new TrackRequestProcessingOptionType[1];
request.ProcessingOptions[0] = TrackRequestProcessingOptionType.INCLUDE_DETAILED_SCANS;
return request;
}
//you can Track 30 Numbers at a time in fedex