以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  HTTP server运行错误  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=183439)

--  作者:zjjlngj
--  发布时间:2022/11/5 11:05:00
--  HTTP server运行错误
图片点击可在新窗口打开查看



If Not HttpServer.issupported Then
    MessageBox.Show("当前系统不支持HTTP服务模式,请更换系统再尝试")
    Return
End If

Dim txtHttpServer As WinForm.TextBox = e.Form.Controls("txtHttpServer")
Dim lbl As WinForm.Label = e.Form.Controls("lbl")
Dim url As String = txtHttpServer.Text
If url > "" Then
    For Each u As String In url.Replace(chr(10), "").Split(chr(13))
        If u > "" Then
            HttpServer.Prefixes.Add(u)
            HttpServer.WebPath = "d:\\web"
        End If 
    Next
    HttpServer.Start()
    lbl.Text = "启动中"
Else
    MessageBox.Show("未设置ip地址,请设置后重新启动http服务")
End If

--  作者:有点蓝
--  发布时间:2022/11/5 11:30:00
--  
httprequest事件代码出错
--  作者:zjjlngj
--  发布时间:2022/11/5 12:49:00
--  
\'e.WriteString(Vars("测试"))

Dim token = "" \'必须和设置的Token相同          
Dim signature As String = e.GetValues("signature")
Dim timestamp As String = e.GetValues("timestamp")
Dim nonce As String = e.GetValues("nonce")
Dim encrypt As String = e.PlainText
Dim jo As JObject = JObject.Parse(encrypt)
Dim ding As New DingTalkEncryptor("", "", "")
Dim res As String = ding.getDecryptMsg(signature, timestamp, nonce, jo("encrypt"))
\'其它处理
Dim msg = ding.getEncryptedMap("success")
Dim po As New JObject 
po("msg_signature") = CStr(msg("msg_signature"))
po("timeStamp") = CStr(msg("timeStamp"))
po("nonce") = CStr(msg("nonce"))
po("encrypt") = CStr(msg("encrypt"))
\'MessageBox.Show(po.ToString)
e.WriteString(po.ToString) \'返回success的加密数据
\'ClipBoard.SetText(res)
\'MessageBox.Show(res)

Dim joReturn As JObject = JObject.Parse(res)

Select Case joReturn("EventType")
    Case "bpms_instance_change"
        MessageBox.Show("事件返回成功")
End Select

--  作者:zjjlngj
--  发布时间:2022/11/5 12:49:00
--  
麻烦看下哪里错误


--  作者:有点蓝
--  发布时间:2022/11/5 13:46:00
--  
调试看哪一句代码出错:http://www.foxtable.com/webhelp/topics/1485.htm
--  作者:zjjlngj
--  发布时间:2022/11/5 14:16:00
--  
试试看
--  作者:zjjlngj
--  发布时间:2022/11/7 9:21:00
--  
有时可以  有时不行   排查不到原因 麻烦再看看
--  作者:zjjlngj
--  发布时间:2022/11/7 9:34:00
--  
定位了  问题出现在这段代码

Dim joencrypt As JObject = JObject.Parse(encrypt)
Dim ding As New DingTalkEncryptor("", "", "")
Dim res As String = ding.getDecryptMsg(signature, timestamp, nonce, joencrypt("encrypt"))

--  作者:有点蓝
--  发布时间:2022/11/7 10:03:00
--  
Dim joencrypt As JObject = JObject.Parse(encrypt)
msgbox(joencrypt )
Dim ding As New DingTalkEncryptor("", "", "") \'这里是不是应该传入有意义的参数,而不是空字符串
msgbox(joencrypt("encrypt").tostring)
Dim res As String = ding.getDecryptMsg(signature, timestamp, nonce, joencrypt("encrypt"))
msgbox(res )

--  作者:zjjlngj
--  发布时间:2022/11/7 10:40:00
--  
参数是有的   我把它删了