I googled for same but couldn't found any. Then i decide to it by server side in ROR
here it is how to get UPS and Fedex xml request and response from their test servers
For Fedex:
track_no = '111111111111' (This is test track no)
This XML Request body for fedex
xml_req =
"YOUR_ACC_KEY
YOUR_ACC_PASSWORD
YOUR_ACC_NUMBERYOUR_ACC_METER_NUMBER
ActiveShipping
trck300
#{track_no}TRACKING_NUMBER_OR_DOORTAG
1"
path = "https://gatewaybeta.fedex.com:443/xml"
#this url connects to the test server of fedex
# for live server url is:"https://gateway.fedex.com:443/xml"
url = URI.parse(path)
http = Net::HTTP.new(url.host,url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
response = http.post(url.path, xml_req)
response_body = response.body
res = response_body.gsub(/<(\/)?.*?\:(.*?)>/, '<\1\2>')
hash = Hash.from_xml(res.to_s)
and that's it you will get response in hash variable, I converted xml response in to Hash because we can easily use Hash object at our view to display response data.
For UPS:
track_no = '1Z12345E1512345676' (This is test track no)
This XML Request body for UPS
xml_req =
'YOUR_ACC_LICENCE_NUMBER
YOUR_ACC_USER_IDYOUR_ACC_PASSWORD
QAST Track1.0
Trackactivity
#{track_no}'
path = "https://www.ups.com/ups.app/xml/Track"
url = URI.parse(path)
http = Net::HTTP.new(url.host,url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
response = http.post(url.path, xml_req)
response_body = response.body
hash = Hash.from_xml(response_body.to_s)
this hash variable contains the response of UPS Tracking Request in Hash format