首页 新闻 会员 周边 捐助

联邦快递跟踪接口

0
悬赏园豆:50 [待解决问题]

本人最近需要开发联邦快递的订单跟踪接口,但是在用联邦快递提供的Demo测试的时候,根据跟踪单号总是查不到信息,如果哪位有做过这个接口的,请赐教,万分感激。

Luoxiaojie的主页 Luoxiaojie | 初学一级 | 园豆:101
提问于:2012-06-26 16:43
< >
分享
所有回答(6)
0

联邦快递提供的Demo  "Demo"呢???

Angkor--:-- | 园豆:1086 (小虾三级) | 2012-06-26 16:54
View Code
  1 // This code was built using Visual Studio 2005
  2 using System;
  3 using TrackWebServiceClient.TrackServiceWebReference;
  4 using System.Web.Services.Protocols;
  5 
  6 //
  7 // Sample code to call the FedEx Track Web Service
  8 //
  9 
 10 namespace TrackWebServiceClient
 11 {
 12     class Program
 13     {
 14         static void Main(string[] args)
 15         {
 16             TrackRequest request = CreateTrackRequest();
 17             //
 18             TrackService service = new TrackService(); // Initialize the service
 19             //
 20             try
 21             {
 22                 // This is the call to the web service passing in a TrackRequest and returning a TrackReply
 23                 TrackReply reply = service.track(request);
 24                 if (reply.HighestSeverity == NotificationSeverityType.SUCCESS || reply.HighestSeverity == NotificationSeverityType.NOTE || reply.HighestSeverity == NotificationSeverityType.WARNING) // check if the call was successful
 25                 {
 26                     ShowTrackReply(reply);
 27                 }
 28                 ShowNotifications(reply);
 29             }
 30             catch (SoapException e)
 31             {
 32                 Console.WriteLine(e.Detail.InnerText);
 33             }
 34             catch (Exception e)
 35             {
 36                 Console.WriteLine(e.Message);
 37             }
 38             Console.WriteLine("Press any key to quit!");
 39             Console.ReadKey();
 40         }
 41 
 42         private static TrackRequest CreateTrackRequest()
 43         {
 44             // Build the TrackRequest
 45             TrackRequest request = new TrackRequest();
 46             //
 47             request.WebAuthenticationDetail = new WebAuthenticationDetail();
 48             request.WebAuthenticationDetail.UserCredential = new WebAuthenticationCredential();
 49             request.WebAuthenticationDetail.UserCredential.Key = "HPJKBEnK0WpuyYRy"; // Replace "XXX" with the Key
 50             request.WebAuthenticationDetail.UserCredential.Password = "N4q8W2qx4Q8vFRobr7aRzZAOK"; // Replace "XXX" with the Password
 51             //
 52             request.ClientDetail = new ClientDetail();
 53             request.ClientDetail.AccountNumber = "510087143"; // Replace "XXX" with client's account number
 54             request.ClientDetail.MeterNumber = "118559631"; // Replace "XXX" with client's meter number
 55             //
 56             request.TransactionDetail = new TransactionDetail();
 57             request.TransactionDetail.CustomerTransactionId = "***Track v5 Request using VC#***";  //This is a reference field for the customer.  Any value can be used and will be provided in the response.
 58             //
 59             // Creates the Version element with all child elements populated from the wsdl
 60             request.Version = new VersionId();
 61             //
 62             // Tracking information
 63             request.PackageIdentifier = new TrackPackageIdentifier();
 64             request.PackageIdentifier.Value = "794800025580"; // Replace "XXX" with tracking number or door tag 524415432078 524415432089
 65             request.PackageIdentifier.Type = TrackIdentifierType.TRACKING_NUMBER_OR_DOORTAG;
 66             
 67             //
 68             // Date range - optional it may be specified or omitted
 69             // If omitted, set to false
 70             request.ShipDateRangeBegin = DateTime.Parse("06/01/2011"); //MM/DD/YYYY
 71             request.ShipDateRangeEnd = request.ShipDateRangeBegin.AddDays(60);
 72             request.ShipDateRangeBeginSpecified = true;
 73             request.ShipDateRangeEndSpecified = true;
 74             
 75             // Include detailed scans - optional it may be specified or omitted
 76             // If omitted, set to false
 77             request.IncludeDetailedScans = true;
 78             request.IncludeDetailedScansSpecified = true;
 79             return request;
 80         }
 81 
 82         private static void ShowTrackReply(TrackReply reply)
 83         {
 84             Console.WriteLine("Tracking details:");
 85             Console.WriteLine("**************************************");
 86             // Track details for each package
 87             foreach (TrackDetail trackDetail in reply.TrackDetails)
 88             {
 89                 Console.WriteLine("Tracking number: {0}", trackDetail.TrackingNumber);
 90                 Console.WriteLine("Tracking number unique identifier: {0}", trackDetail.TrackingNumberUniqueIdentifier);
 91                 Console.WriteLine("Track Status: {0} ({1})", trackDetail.StatusDescription, trackDetail.StatusCode);
 92                 Console.WriteLine("Carrier code: {0}", trackDetail.CarrierCode);
 93                 
 94                 if (trackDetail.OtherIdentifiers != null)
 95                 {
 96                     foreach (TrackPackageIdentifier identifier in trackDetail.OtherIdentifiers)
 97                     {
 98                         Console.WriteLine("Other Identifier: {0} {1}", identifier.Type, identifier.Value);
 99                     }                    
100                 }
101                 if (trackDetail.ServiceInfo != null)
102                 {
103                     Console.WriteLine("ServiceInfo: {0}", trackDetail.ServiceInfo);
104                 }
105                 if (trackDetail.PackageWeight != null)
106                 {
107                     Console.WriteLine("Package weight: {0} {1}", trackDetail.PackageWeight.Value, trackDetail.PackageWeight.Units);
108                 }
109                 if (trackDetail.ShipmentWeight != null)
110                 {
111                     Console.WriteLine("Shipment weight: {0} {1}", trackDetail.ShipmentWeight.Value, trackDetail.ShipmentWeight.Units);
112                 }
113                 if (trackDetail.Packaging != null)
114                 {
115                     Console.WriteLine("Packaging: {0}", trackDetail.Packaging);
116                 }                
117                 Console.WriteLine("Package Sequence Number: {0}", trackDetail.PackageSequenceNumber);          
118                 Console.WriteLine("Package Count: {0} ", trackDetail.PackageCount);
119                 if (trackDetail.ShipTimestampSpecified)
120                 {
121                    Console.WriteLine("Ship timestamp: {0}", trackDetail.ShipTimestamp);
122                 }
123                 if (trackDetail.DestinationAddress != null)
124                 {
125                    Console.WriteLine("Destination: {0}, {1}", trackDetail.DestinationAddress.City, trackDetail.DestinationAddress.StateOrProvinceCode);
126                 }
127                 if (trackDetail.ActualDeliveryTimestampSpecified)
128                 {
129                    Console.WriteLine("Actual delivery timestamp: {0}", trackDetail.ActualDeliveryTimestamp);
130                 }
131                 if (trackDetail.SignatureProofOfDeliveryAvailableSpecified)
132                 {
133                     Console.WriteLine("SPOD availability: {0}", trackDetail.SignatureProofOfDeliveryAvailable);
134                 }
135                 if (trackDetail.NotificationEventsAvailable != null)
136                 {
137                     foreach (EMailNotificationEventType notificationEventType in trackDetail.NotificationEventsAvailable)
138                     {
139                         Console.WriteLine("EmailNotificationEvent type : {0}", notificationEventType);
140                     }
141                 }
142 
143                 //Events
144                 Console.WriteLine();
145                if (trackDetail.Events != null)
146                {
147                    Console.WriteLine("Track Events:");
148                    foreach (TrackEvent trackevent in trackDetail.Events)
149                    {
150                        if (trackevent.TimestampSpecified)
151                        {
152                            Console.WriteLine("Timestamp: {0}", trackevent.Timestamp);
153                        }
154                        Console.WriteLine("Event: {0} ({1})", trackevent.EventDescription, trackevent.EventType);
155                        Console.WriteLine("***");
156                    }
157                    Console.WriteLine();
158                }
159                Console.WriteLine("**************************************");
160             }
161         }
162 
163         private static void ShowNotifications(TrackReply reply)
164         {
165             Console.WriteLine("Notifications");
166             for (int i = 0; i < reply.Notifications.Length; i++)
167             {
168                 Notification notification = reply.Notifications[i];
169                 Console.WriteLine("Notification no. {0}", i);
170                 Console.WriteLine(" Severity: {0}", notification.Severity);
171                 Console.WriteLine(" Code: {0}", notification.Code);
172                 Console.WriteLine(" Message: {0}", notification.Message);
173                 Console.WriteLine(" Source: {0}", notification.Source);
174             }
175         }
176     }
177 }

这是Demo,给定的跟踪好总是查不到信息

支持(0) 反对(0) Luoxiaojie | 园豆:101 (初学一级) | 2012-06-26 17:18

@Luoxiaojie: 报什么错误?一步步的调试看。。。。!

支持(0) 反对(0) Angkor--:-- | 园豆:1086 (小虾三级) | 2012-06-26 17:21
0

你先用DEMO,别自己写代码,看是否调用成功。

如果这个调用不成功,那可能是网络问题了(使用FIDDLER跟踪下)。

如果这个调用成功,再去查看自己写的代码有哪些问题。

无之无 | 园豆:5095 (大侠五级) | 2012-06-26 17:30
0

你可以试试这家的接口 很有用 支持所有快递和物流查询 http://webservice.36wu.com/ExpressService.asmx 

醉代码 | 园豆:204 (菜鸟二级) | 2012-12-05 10:22
0

楼主  求指点啊  你的联邦快递接口是在哪里找到的啊   我怎么就没找到呢    

①尘不染 | 园豆:11 (初学一级) | 2013-05-07 17:28

联邦的官网就有啊!

支持(0) 反对(0) Luoxiaojie | 园豆:101 (初学一级) | 2013-05-08 08:36

@Luoxiaojie: 求指点   我找了老久就是木有找到API啊

支持(0) 反对(0) ①尘不染 | 园豆:11 (初学一级) | 2013-05-08 09:28
0

你好楼主,我在运行联邦demo的时候遇到这个问题,请问你那里遇到过没有。请教一下

“System.InvalidOperationException”类型的未经处理的异常在 System.Xml.dll 中发生

其他信息: 无法生成临时类(result=1)。

error CS0029: 无法将类型“TrackWebServiceClient.TrackServiceWebReference.EMailNotificationEventType”隐式转换为“TrackWebServiceClient.TrackServiceWebReference.EMailNotificationEventType[]”

五天 | 园豆:8 (初学一级) | 2016-04-04 10:26

我也遇到这个问题了,你解决了吗?

支持(0) 反对(0) z814495278 | 园豆:200 (初学一级) | 2016-06-07 12:51

@z814495278: 

大神您好。

我在Fedex官网https://www.fedex.com/us/developer/web-services/process.html?tab=tab2#app-tab2

只能下载到【Rate】的wsdl文件,

我想要下载【Tracking and Visibility】的,可是点击那个【SHOW】死活就出不来。

求帮助。

支持(0) 反对(0) haha999 | 园豆:200 (初学一级) | 2016-06-20 13:22
0

我想调用fedex的根据地址判断发货方式的api,请问哪里有demo啊?fedex的api文档已经有了,第8章节也说明有该功能,可是怎么调用?英文菜鸟,api菜鸟,希望路过的大神指点一下。

nyxuem | 园豆:204 (菜鸟二级) | 2016-11-28 14:38
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册