Question
· Oct 16, 2023

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:

  1. When using a URL without the final slash (e.g., https://<renderProjectName>.onrender.com), the message is successfully sent but I get the error HTTP/1.1 307 Temporary Redirect.
  2. When using a URL containing the final slash (e.g., https://<renderProjectName>.onrender.com/), The message is not sent and the error ERROR #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() 

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

Product version: IRIS 2021.1
Discussion (4)1
Log in or sign up to continue

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("/")