Web Connection
Posting JSON Data using httpget
I need to post JSON Data into a url. Somehow, not working for me with the following code:
Ohttp=NEWOBJECT("WWhTTP","\SHCOMMON\WCONNECT\CLASSES\WWHTTP.PRG")
oHTTP.AddHeader("Authorization",m.cUtrade_Authorisation)
oHttp.cContentType = "application/json"
* Now set the JSON
oHttp.AddPostKey(m.cJson)
* Now hit the server
oHttp.httpGet(m.cUtrade_Url)
Any help will be appreciated -- Pinaki
Not helpful when all you provide - is It's not working.
- Error codes if any?
- What is the server response if any?
- Response headers?
The oHttp.nError is "12037" and oHttp.cErrorMsg is "The date in the certificate is invalid or has expired"
can I ignore the ssl certificate error?
++ Pinaki
This sounds like an expired server certificate which means the certificate is basically invalid.
Yes you can ignore the certificate error, but it's really not recommended!
#include wconnect.h && to get the flag constant
loHttp = CREATEOBJECT("wwHttp")
loHttp.nHttpServiceFlags = INTERNET_FLAG_IGNORE_CERT_DATE_INVALID
There are a number of other Certificate ignore flags in wconnect.h
.
None of this is recommended. If the cert is expired or invalid it isn't secure and defeats the purpose of using TLS in the first place.
+++ Rick ---