Foxtable(狐表)用户栏目专家坐堂 → [求助]申通接口写法Base64怎么写?


  共有3353人关注过本帖平板打印复制链接

主题:[求助]申通接口写法Base64怎么写?

帅哥哟,离线,有人找我吗?
zto001
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1465 积分:10397 威望:0 精华:0 注册:2018/10/16 11:42:00
  发帖心情 Post By:2020/12/16 17:53:00 [只看该作者]

'Public Shared Function LinkTest() As String
Dim responseArray As Byte() = Nothing
Dim url As String = "http://cloudinter-linkgatewaytest.sto.cn/gateway/link.do"

Using webClient As System.Web.WebClient = New System.Web.WebClient()
Dim postValues As NameValueCollection = New NameValueCollection()
Dim secretKey As String = "123abc"
Dim content As String = "{""orderNo"":""8885452262"",""orderSource"":""VIPEO""}"
Dim dataDigest As String = 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)
End Using

Dim response As String = Encoding.UTF8.GetString(responseArray)
Return response
End Function

Public Shared Function CalculateDigest(ByVal content As String, ByVal secretKey As String) As String
Dim toSignContent As String = content & secretKey
Dim md5 As System.Security.Cryptography.MD5 = System.Security.Cryptography.MD5.Create()
Dim inputBytes As Byte() = System.Text.Encoding.GetEncoding("utf-8").GetBytes(toSignContent)
Dim hash As Byte() = md5.ComputeHash(inputBytes)
Return Convert.ToBase64String(hash)
End Function


我去掉第一行,提示
编译错误:语句不能出现在方法体/多行lambda外。
错误代码: Using webClient As System.Web.WebClient = NewSystem.Web.WebCliento

还有 其它.net类型的命名空间都补齐了吗?
是什么意思?


 回到顶部
总数 22 1 2 3 下一页