· Dec 2, 2021

2017 ensemble POST not working and not giving any error

I am totally struck and last 3 days I am not able to progress much. Here I need to call POST method in REST endpoint in Business Operation.

Please find the code below, which is working fine in IRIS 2020.1 but not in cache 2017.

Set httpRequest= ##class(%Net.HttpRequest).%New()
Set httpRequest.Server = ..Adapter.HTTPServer
Set httpRequest.Location = ..Adapter.URL
Set httpRequest.SSLConfiguration = ..Adapter.SSLConfig Set httpRequest.Https = $$$YES
Set httpRequest.ContentType = "application/x-www-form-urlencoded" do httpRequest.InsertFormData("grant_type", pRequest.grantType)
do httpRequest.InsertFormData("username", pRequest.username)
do httpRequest.InsertFormData("password", pRequest.password) Set sc = httpRequest.Post("", 2) $$$LOGINFO("post"_httpRequest.HttpResponse)
catch ex
$$$LOGINFO("Exception:" _ex) }

This code is working fine and giving the resonse in  IRIS2020.1 in mylocal. Same code is not working in cache 2017.

Could you please suggest change to make it work in cache 2017,.



Product version: Caché 2017.1
Discussion (8)2
Log in or sign up to continue

Hi All

Set sc httpRequest.Post("", 2)

I tried to sc to loginfo below output I received. Any clue to resolve this issue. Please help me.

ENSEMBLEÇ'e^zCheckSSLCN+48^%Net.HttpRequest.1^1"e^zSend+188^%Net.HttpRequest.1^1 e^zPost+1^%Net.HttpRequest.1^1Se^zinvokeTokenAPI+13^THH.DocmanConnect.BusinessOperation.DocmanConnectTokenOP.1^1Re^zMessageHandler+6^THH.DocmanConnect.BusinessOperation.DocmanConnectTokenOP.1^1Ye^zMessageHeaderHandler+23^THH.DocmanConnect.BusinessOperation.DocmanConnectTokenOP.1^1e^zOnTask+42^Ens.Host.1^1e^zStart+62^Ens.Job.1^2$d^StartEnsembleJob+6^|"%SYS"|STU^1d^^^0

Hi Prashanth,

Based on the error status, this looks like an invalid SSL certificate on the REST endpoint. The certificate name is "*" but the server name is "". The certificate would need to have "*" to cover that domain. I would try calling the same endpoint in another test client (or even a web browser) to see if it gives you the same certificate error. If so you would have to get in touch with the owner of that API to fix their certificate.

If you're only able to replicate the issue in your Caché instance I would contact InterSystems Support.

As a last resort, you can probably disable checking the server certificate by doing:

set httpRequest.SSLCheckServerIdentity = 0

This is not recommended because it's insecure, but it might be useful as a debugging tool.