Question
Rochdi Badis · Jul 19

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)?

Token=GetToken()
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()
 "Sent file for Job : "_JobId_" Status Code : "_StateCode_"|"_status_"|"_Resp

 

 

Thanks

Product version: Caché 2014.1
0
0 78
Discussion (6)1
Log in or sign up to continue

Hi.

What status (tSc) do you get?

Regards,
Matjaž

How to check the Status in tSc, tSc.StatusCode?

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 ? 

WRITE $System.Status.GetOneStatusText(tSc,1),!

Are you testing from same machine? Maybe the firewall is causing the problem?