That's exactly what I am doing...using OnInit method:

Method OnInit() As %Status

// Add info to the log.
$$$LOGINFO("Run by:"_$Username)
$$$LOGINFO(" > "_$SYSTEM.Process.UserName())

Nothing works...

Thank you but not sure about what you said.

I don't have a %request. It is just a Business Service doing nothing...and all I want is to get the username who enable it last time. Well, actually not last time. The service is normally off, so when is turned on, I want the username to be recorded in the log.

I have a function which actually run "write $USERNAME" and if I run it from Studio returns the username!

Thanks but I am afraid that did not work... when adding that into my service code and run it... I had an error message:

ERROR <Ens>ErrException: <UNDEFINED>zOnInit+14^CUH.Serv.ODSCodeGlobalUpdate.1 *%request -- logged as '-' number - @' Do ##class(Ens.Util.Log).LogInfo($classname(),"OnInit",%request.GetCookie("Username"))'

ERROR <Ens>ErrException: <UNDEFINED>zOnInit+13^CUH.Serv.ODSCodeGlobalUpdate.1 ^CacheTemp.EnsUsername(960) -- logged as '-' number - @' Do ##class(Ens.Util.Log).LogInfo($classname(),"OnInit",^CacheTemp.EnsUsername($job))'

not working but ping could be blocked in a firewall...and when I tried from my local PC, ping did not work either...

I could be wrong but I am pretty sure is something blocking that connection but maybe based on the protocol...not sure...what I cannot understand is why browse to the web site works but httprequest not.


I have tried by IP, apparently

so  in IE: => ok, => ok

but using:

Set httprequest=##class(%Net.HttpRequest).%New()
Set httprequest.Server = ""
Set httprequest.Port=80
set status = httprequest.Get("/",2)
DO $system.OBJ.DisplayError(status)

ERROR #6059: Unable to open TCP/IP socket to server

I have no idea what's going on

Thanks for the help:

1. I have tried from the server where ensemble is running. In IE, I can access but when trying from studio...nothing blank response...all from the same matchine!

2. I tried that and yes...ERROR #6059: Unable to open TCP/IP socket to server so I think you are right but I cannot believe the problem is no visibility when in IE I can access the website with no issues.

Thanks for your help... I think the problem I am having is not with my code but with ensemble or IT. Apparently somehow the connection to external content is blocked. I can access to the websites with no issues from web browsers but when trying to access from studio or test SSL from ensemble...error!!

Is there any security configuration to block that kind of access in ensemble?


I have tried to created an SSL/TLS configuration but not sure why is not working:

It does not matter what I try to test it...always returns the same error:

ERROR #989: SSL connection failed, make sure server address and port (not url) is specified

I tried "" 443, "" 443...nothing

Those sites I am trying to connect to....don't really need anything special to connect...just url


Yo are absolutely right although I am still confused.

I copied httprequest.Get("",2) from one example found in the documentation so I was expected to work. Also, to get data from a website don't think you have to use https or SSL right? I tried with different APIs in other applications and just passing the right URL I was able to retreive the data.

About httprequest.HttpResponse  you are right again... I was using httprequest.HttpResponse.Data and outputtodevice but I was having an error as the object did not I tried to check if the object was really created or not...

What would be the right script to connect then? I am trying to get data from this API