- Gayathri Narayanan
- PowerBuilder
- Tuesday, 21 July 2020 10:39 PM UTC
Here is my code. The block in red returns 1 (success code) in development and also in the exe when deployed on a machine which has PowerBuilder 2017 R3 installed
But when attempting to run this on a user machine without PowerBuilder, it returns -1 into li_rc and -3 into l_i_response
integer li_rc, l_i_response
String ls_ReturnJson, l_s_authorization
HttpClient lnv_HttpClient
lnv_HttpClient = Create HttpClient
l_s_authorization = 'Bearer' + " " +mle_accesstoken.text
lnv_HttpClient.SetRequestHeader("Authorization",l_s_authorization)
li_rc = lnv_HttpClient.SendRequest("GET", "<url site name>")
l_i_response = lnv_HttpClient.GetResponseStatusCode()
if li_rc = 1 and l_i_response = 200 then
lnv_HttpClient.GetResponseBody(ls_ReturnJson)
mle_body. text = ls_ReturnJson
Messagebox(string(l_i_response), ls_ReturnJson)
Else
lnv_HttpClient.GetResponseBody(ls_ReturnJson)
mle_body. text = ls_ReturnJson
Messagebox(string(l_i_response), string(li_rc) + '-' + ls_ReturnJson)
end if
Client machines have pbhttpclient170.dll, pbjson170.dll, pboauth170.dll, pbrestclient170.dll in the same directory as the exe. We have a lot of httpclient calls in our real application. As we found that the client machine could not connect, we wrote the simple code above to check what happens when we send requests using lnv_HttpClient.SendRequest
Any ideas, please???
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.