Empty HTTP response
Hi Guys,
We use the below code to send JSON file to one of our clients and was working fine but I think lately they did a windows update and now whenever we send file we aren't getting any HTTP responses, success or Error, just empty response ()
the think is that it works fine and we get 200 response if we send the JSON file using our client's portal called swagger which is a website where you can assign the token and url (Swagger UI (vibra-api-prod.azurewebsites.net))
nothing has change from our end so why we aren't getting any HTTP response as all (see below)?
s Token=GetToken()
S FilePath="D:\CollectionGood_10733899.json"
Set File = ##class(%File).%New(FilePath)
Do File.Open("R")
Set Httprequest=##class(%Net.HttpRequest).%New()
Set Httprequest.SSLConfiguration="RTLS"
Set Httprequest.Server="url"
Set Httprequest.Timeout=30
Set Httprequest.Https=1
set Httprequest.ContentType="application/json"
Do Httprequest.SetHeader("Accept","*/*")
Do Httprequest.SetHeader("Authorization","Bearer "_Token)
do Httprequest.EntityBody.CopyFrom(File)
Set tSc=Httprequest.Post("/api/sensors/vibration")
Set StateCode=Httprequest.HttpResponse.StatusCode
Set status=Httprequest.HttpResponse.StatusLine
Set Resp=Httprequest.HttpResponse.Data.Read()
Q "Sent file for Job : "_JobId_" Status Code : "_StateCode_"|"_status_"|"_Resp
.png)
Thanks
Comments
Hi.
What status (tSc) do you get?
Regards,
Matjaž
How to check the Status in tSc, tSc.StatusCode?
$SYSTEM.Status.GetErrorText(tSC) will work.
I get 0 followed by some gibberish as below, so I guess it's zero, which mean the post didn't go through, but how come it does from their portal (swagger) and our code use to work and we haven't change anything ?
.png)
WRITE $System.Status.GetOneStatusText(tSc,1),!
Are you testing from same machine? Maybe the firewall is causing the problem?