我们用 ERP 调用奇门 URL 演示加密算法:
http://qimenapi.tbsandbox.com/router/qimen/service?method=tao
bao.qimen.itemlack.report ×tamp=2015-04-26
00:00:07&format=xml&app_key=testerp_appkey&v=2.0&sign=abc&sig
n_method=md5&customerId=stub-cust-code
method= taobao.qimen.itemlack.report timestamp=2015-04-26 00:00:07 format=xml app_key= testerp_appkey v=2.0 sign_method=md5 customerId =test
app_key= testerp_appkey customerId = stub-cust-code format=xml method= taobao.qimen.entryorder.query sign_method=md5 timestamp=2015-04-26 00:00:07 v=2.0
连接参数名与参数值,并在首尾加上secret,此处假设secret=test,如下: testapp_keytesterp_appkeycustomerIdstub-cust-codeformatxmlmethodtaobao.qimen.itemlack.reportsign_methodmd5timestamp2015- 04-26 00:00:07v2.0bodytest 其中:body用请求中的body数据代替
32位大写MD5值-> D06D88CB34B2EC0E5C9BAB396C9542B6
将所有参数值转换为UTF-8编码,然后拼装,并作URL ENCODING 如下: http://qimenapi.tbsandbox.com/router/qimen/service?method=taobao.qimen.itemlack.report×tamp=2015-04- 26%2000:00:07&format=xml&app_key=testerp_appkey&v=2.0&sign=D06D88CB34B2EC0E5C9BAB396C9542B6&sign_method=md5&customerId= stub-cust-code