4.11 可选sign签名算法
我们用ERP调用VWMS URL演示加密算法:
http:// sandbox.vwms.cn/open/service?method=openapi.stockout.create×tamp=2015-04-26 00:00:07&format=xml&app_key=testerp_appkey&v=2.0&sign=abc&sign_method=md5&customerId=stub-cust-code
4.11.1 输入参数为
method= openapi.stockout.create
timestamp=2015-04-26 00:00:07
format=xml
app_key= testerp_appkey
v=2.0
sign_method=md5
customerId =test
4.11.2 按首字母升序排列
app_key= testerp_appkey
customerId = stub-cust-code
format=xml
method= openapi.stockout.create
sign_method=md5
timestamp=2015-04-26 00:00:07
v=2.0
4.11.3 连接字符串
连接参数名与参数值,并在首尾加上secret,此处假设secret=test,如下:
testapp_keytesterp_appkeycustomerIdstub-cust-codeformatxmlmethod openapi.stockout.createsign_methodmd5timestamp2015-04-26 00:00:07v2.0_body_test
其中:body用请求中的body数据代替
4.11.4 生成签名sign
32位大写MD5值->D06D88CB34B2EC0E5C9BAB396C9542B6
4.11.5 拼装URL请求
将所有参数值转换为UTF-8编码,然后拼装,并作URL ENCODING 如下:
http://sandbox.vwms.cn/open/service?method= opeanapi.stockout.create×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