How to send a message to Render and gunicorn-deployed web service
Hi everyone,
My problem today is how to send an HTTP message to a web service deployed via Render and gunicorn.
Issue
Every time I try to contact the web service I get an error. Searching on the web, I've found this StackOverflow question that suggests the issue could be set off from a missing "/" character in the endpoint string.
I've tried in many ways, both including and excluding the final slash character, but I always get an error:
- When using a URL without the final slash (e.g.,
https://<renderProjectName>.onrender.com
), the message is successfully sent but I get the errorHTTP/1.1 307 Temporary Redirect
. - When using a URL containing the final slash (e.g.,
https://<renderProjectName>.onrender.com/
), The message is not sent and the errorERROR #6059: Impossible to open TCP/IP with server <renderProjectName>.onrender.com/:80 returns.
My objectscript code is something like:
Set httpRequest = ##class(%Net.HttpRequest).%New()
Set httpRequest.ContentType = "application/json"
Set httpRequest.Server = "renderProjectName.onrender.com"
Set messageStatus = httpRequest.Post()
ObjectScriptObjectScript
Note that "http://
" is omitted from the name, as said in the documentation.
How can I set the endpoint to correctly access the web service? I can reach that URL via Postman, both using or not the final slash. I have this problem only with IRIS
Your example shows https but you try a http connection. Is this a mistake or a typo?
Thanks, Julius! That was part of the problem. I'm still facing some issue but now I'm able to reach a web service deployed with another program (in the next days I will retry with Render).
Hello
You can send you're POST/GET URL's as part of the method itself. Refer the below sample codes
Set httprequest=##class(%Net.HttpRequest).%New() Set httpRequest.ContentType = "application/json" Set httpRequest.Server = "renderProjectName.onrender.com" set httprequest.https=1 ;add this additional set if you're going to make it as a HTTPS call set httprequest.SSLConfiguration = "your ssl certificate" ; include the certificate as well for HTTPS call's Do httprequest.Post("/")
Thanks!!