这个东西也要吧
这个文件怎么没有dll可以调用
2..NET
调用示例:
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Net;
using System.Security.Cryptography;
using System.Text;
using System.Web;
namespace LinkRequest
{
class Program
{
public static void Main(string[] args)
{
string response = LinkTest();
Console.WriteLine(response);
Console.ReadLine();
}
public static string LinkTest()
{
byte[] responseArray = null;
string url = "http://cloudinter-linkgatewaytest.sto.cn/gateway/link.do";
using (WebClient webClient = new WebClient())
{
NameValueCollection postValues = new NameValueCollection();
string secretKey = "123abc";
string c;
string dataDigest = CalculateDigest(content, secretKey);
postValues.Add("content", content);
postValues.Add("data_digest", dataDigest);
postValues.Add("api_name", "OMS_EXPRESS_ORDER_CREATE");
postValues.Add("from_appkey", "sto_test");
postValues.Add("from_code", "sto_test_code");
postValues.Add("to_appkey", "sto_oms");
postValues.Add("to_code", "sto_oms");
webClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
responseArray = webClient.UploadValues(url, "POST", postValues);
}
string response = Encoding.UTF8.GetString(responseArray);
return response;
}
//加密
public static string CalculateDigest(string content, string secretKey)
{
string toSignContent = content + secretKey;
System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create();
byte[] inputBytes = System.Text.Encoding.GetEncoding("utf-8").GetBytes(toSignContent);
byte[] hash = md5.ComputeHash(inputBytes);
return Convert.ToBase64String(hash);
}
}
}
[此贴子已经被作者于2020/12/15 20:30:38编辑过]