Question
· Dec 15, 2020

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?  

Discussion (2)1
Log in or sign up to continue