How to set a port different to the default port on EnsLib.HTTP.OutboundAdapter using HTTPS
We have a webserver which is using a port different to 443 for HTTPS communication. I can connect from the terminal session but not via the EnsLib.HTTP.OutboundAdapter.
the example used in Terminal:
set httprequest=##class(%Net.HttpRequest).%New()
set httprequest.Server="appserver"
set httprequest.Port="4999"
set httprequest.Https=1
set httprequest.SSLConfiguration="app server"
do httprequest.SetHeader("Custom","cust")
set httprequest.ContentType="application/json"
do httprequest.EntityBody.CopyFrom(jsonfile)
do httprequest.Post("/FHIR/Bundle")
And this is my method using the EnsLib.HTTP.OutboundAdapter:
Method PostJSONObjectTemp(pRequest As MyProduction.PostFHIRRESTRequestTemp, pResponse As Ens.Response) As %Status { Try { Set httprequest=##class(%Net.HttpRequest).%New() set httprequest.Server = "appserver" set httprequest.Https = 1 set httprequest.Port = "4999" set httprequest.SSLConfiguration = "app server" Do httprequest.SetHeader("Custom","cust") set httprequest.ContentType="application/json" Set httpresponse=##class(%Net.HttpResponse).%New() set status = ..Adapter.SendFormData(httpresponse,"POST",httprequest,"",pRequest.FHIRResourceAsJSON) //If the adaptor returns an error, throw to catch block $$$ThrowOnError(tSC) } catch ex { //Return error status. Will be put in Event Log set tSC = ex.AsStatus() } return tSC }
In my communication logs I see that always port 443 (Default) is used. How can I change it?
Hi Jens,
You need to setup the port in the adapter settings.
In the method SendFormDataArray all adapter settings is passed to http request object.
The Adapter Settings are also not taken into account if I do not pre-populate the properties of the %Net.HTTPRequest object in my method and call the adapter method without it:
Always port 443 is used.