Fedex Tracking Number

一世执手 提交于 2019-12-11 07:14:05

问题


I need to integrate fedex api in my site. How can i get a new tracking number for the first time regarding a shipping. I couldnt find a method to get the tracking number? Please help, if anyone knows.

Thanks


回答1:


I am guessing that you meant "create a FedEx shipment" when you refered to "new tracking number."

FedEx has a developer program in which you can sign up and integrate your website with FedEx. Once you sign up, you can:

  • Create shipments
  • Cancel shipments
  • Track packages
  • Schedule pickup
  • Create call tags
  • Etc.

The link for FedEx developer program is: http://www.fedex.com/us/developer.

Best!




回答2:


The FedEx site for IE returns the webpage in an IFrame across another site. You can't cross sites for information with an Iframe. So instead do the following. You can transmit the following xml to: https://ws.fedex.com:443/web-services

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"   xmlns:v10="http://fedex.com/ws/track/v10">
<soapenv:Header/>
<soapenv:Body>
<v10:TrackRequest>
<v10:WebAuthenticationDetail>
<v10:ParentCredential>
<v10:Key>productionkey</v10:Key>
<v10:Password>productionpassword</v10:Password>
</v10:ParentCredential>
<v10:UserCredential>
<v10:Key>productionkey</v10:Key>
<v10:Password>productionpassword</v10:Password>
</v10:UserCredential>
</v10:WebAuthenticationDetail>
<v10:ClientDetail>
<v10:AccountNumber>accountnumber</v10:AccountNumber>
<v10:MeterNumber>meternumber</v10:MeterNumber>
<v10:IntegratorId/>
<v10:Localization>
<v10:LanguageCode>EN</v10:LanguageCode>
<v10:LocaleCode>us</v10:LocaleCode>
</v10:Localization>
</v10:ClientDetail>
<v10:TransactionDetail>
<v10:CustomerTransactionId>Ground Track By Number</v10:CustomerTransactionId>
<v10:Localization>
<v10:LanguageCode>EN</v10:LanguageCode>
<v10:LocaleCode>us</v10:LocaleCode>
</v10:Localization>
</v10:TransactionDetail>
<v10:Version>
<v10:ServiceId>trck</v10:ServiceId>
<v10:Major>10</v10:Major>
<v10:Intermediate>0</v10:Intermediate>
<v10:Minor>0</v10:Minor>
</v10:Version>
<v10:SelectionDetails>
<v10:CarrierCode>FDXG</v10:CarrierCode>
<v10:PackageIdentifier>
<v10:Type>TRACKING_NUMBER_OR_DOORTAG</v10:Type>
<v10:Value>$WAYBILL$</v10:Value>
</v10:PackageIdentifier>
</v10:SelectionDetails>
<v10:ProcessingOptions>INCLUDE_DETAILED_SCANS</v10:ProcessingOptions>
</v10:TrackRequest>
</soapenv:Body>
</soapenv:Envelope>

Use the following VBA Code to transmit and it will return the tracking info:

Public Function ReturnXMLResponse(ByVal XML_Method As Variant, _
                          ByVal XML_Track_URL As Variant, _
                          ByVal XML_Request As Variant, _
                 Optional ByVal WaybillNum As String = "", _
                 Optional ByVal CarrierName As String = "", _
                 Optional ByVal TotalWaybills As Long = 0, _
                 Optional ByVal XML_Chunks As Long = 1) As String

 ' Passed expressions to this function have to be Variant, as some arguments
 ' may be passed as Null which would result in a type conversion failure.

' If True Then Exit Function
ReturnXMLResponse = "Test" ' default if not supported or not tracked by request
If UCase(XML_Track_URL) <> "NOT SUPPORTED" And UCase(XML_Track_URL) <> "NOT TRACKED BY REQUEST" Then
If (WaybillNum <> "") And (CarrierName <> "") Then
    TrackingCounter = TrackingCounter + (1 / XML_Chunks)
    SBText = "Tracking: " & CarrierName & ":" & WaybillNum
    If TotalWaybills <> 0 Then SBText = SBText & " (" & CLng(TrackingCounter) & "/" & TotalWaybills & ") [" & (TrackingCounter / TotalWaybills) * 100 & "%]"
    SBText = SBText & "."
    Application.SysCmd acSysCmdSetStatus, SBText
End If
Set XMLHTTP = CreateObject("Microsoft.xmlhttp")
If (WaybillNum <> "") And (CarrierName <> "") Then
    SBText = SBText & "."
    Application.SysCmd acSysCmdSetStatus, SBText
End If
XMLHTTP.Open XML_Method, XML_Track_URL, False
If (WaybillNum <> "") And (CarrierName <> "") Then
    SBText = SBText & "."
    Application.SysCmd acSysCmdSetStatus, SBText
End If
XMLHTTP.Send XML_Request ' okay to send blank string, if not needed
If (WaybillNum <> "") And (CarrierName <> "") Then
    SBText = SBText & "."
    Application.SysCmd acSysCmdSetStatus, SBText
End If
ReturnXMLResponse = Cstr(XMLHttp.ResponseText)
End If
If ReturnXMLResponse = "" Then ReturnXMLResponse = "Nothing"
End Function

Basically XMLHTTP.Send XML_Request

'XMLHTTP.Send = Sending the XML_Request which is the soap envelope     
above.  It 'then returns the valid XML.

shareeditdel




回答3:


You can find all type of tracking numbers in the link below. I tested some of them. Response will not be exactly as it is written in dev guide, but It doesn't throw an error. try another one and so on.

  • click this Link

  • Go to the page 2014: Appendix AA: Test Server Mock Tracking Numbers

  • You will see: page with tracking numbers. It worked for me.



来源:https://stackoverflow.com/questions/21597326/fedex-tracking-number

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!