顺丰 丰桥对接 订单路由查询 ruby rails
Posted tomtang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了顺丰 丰桥对接 订单路由查询 ruby rails相关的知识,希望对你有一定的参考价值。
def self.get_express_route_test
url = ‘http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService‘
xml = "<Request service=‘RouteService‘ lang=‘zh-CN‘><Head>4545</Head><Body><RouteRequest tracking_type=‘1‘ method_type=‘1‘ tracking_number=‘444003077898‘/></Body></Request>"
keyword = ‘dsadsa‘
md5_str = Digest::MD5.digest((xml + keyword).encode(‘utf-8‘))
verifyCode = Base64.strict_encode64(md5_str)
uri = URI.parse(url)
req = Net::HTTP::Post.new(uri.path,{‘Content-Type‘ => ‘application/x-www-form-urlencoded;charset=utf-8‘})
req.body = "xml=#{xml}&verifyCode=#{verifyCode}"
req = Net::HTTP.new(uri.host,uri.port).start{|http| http.request(req)}
Rails.logger.debug req.body
end
以上是关于顺丰 丰桥对接 订单路由查询 ruby rails的主要内容,如果未能解决你的问题,请参考以下文章