PB使用MSXML2.ServerXMLHTTP方式send数据时失败

weixin_44893366 2020-09-21 10:42:43

//http协议
ls_xmlhttp[1] = "Msxml2.XMLHTTP.6.0"
ls_xmlhttp[2] = "Msxml2.XMLHTTP.5.0"
ls_xmlhttp[3] = "Msxml2.XMLHTTP.4.0"
ls_xmlhttp[4] = "Msxml2.XMLHTTP.3.0"
ls_xmlhttp[5] = "Msxml2.XMLHTTP"

//http访问对象
lole_token = CREATE oleobject
//lole_token.ConnectToNewObject("Microsoft.XMLHttp")
FOR ll_flag = 1 TO UpperBound(ls_xmlhttp)
lole_token.ConnectToNewObject(ls_xmlhttp[ll_flag])
NEXT

//入参
ls_data = '{"userName":"' + ls_uname + '","password":"' + ls_password + '"}'

//访问http
lole_token.Open("POST",ls_url,FALSE)
lole_token.setRequestHeader("Content-type", "application/json")
lole_token.setRequestHeader('Content-Length',String(Len(ls_data)))
lole_token.Send(ls_data)

执行时报错:
Error: Error calling external object function send at line 99
通过接口测试工具测试,接口是通的,但是pb中运行时,send()报错
这个有什么办法可以获取到具体的错误原因吗?
...全文
515 1 打赏 收藏 举报
写回复
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
wangxun0997 2020-10-01
oleobject lole_Send,lole_SrvHTTP
lole_Send = create oleobject
lole_SrvHTTP = create oleobject
lole_Send.connectToNewObject("MSXML2.DOMDocument.6.0")
lole_SrvHTTP.connectToNewObject("MSXML2.ServerXMLHTTP.6.0")
lole_SrvHTTP.Open("GET","http://xxxx.com/xxx", FALSE)
lole_SrvHTTP.SetRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8")
lole_SrvHTTP.SetRequestHeader("Authorization","xxxxxxxxxx")
lole_SrvHTTP.Send(lole_Send)
ls_results = string(lole_SrvHTTP.Status)
参考...
  • 打赏
  • 举报
回复
发帖
控件与界面
加入

591

社区成员

PowerBuilder 控件与界面
社区管理员
  • 控件与界面社区
申请成为管理员
帖子事件
创建了帖子
2020-09-21 10:42
社区公告
暂无公告