Question
· Aug 10, 2022

%Net.DB.Connection

I am trying to use the IRIS connection to connect from our LIS to Health Connect (ENSEMBLE) directly.  You can do this in the same namespace using this:

##class(Ens.Director).CreateBusinessService(Ensemble Service Name,.theService)
theService.ProcessInput(TRAN,.response)

I would like to be able to do the same thing across servers using IRIS connection.  I have the following connection:

 

                set connection = ##class(%Net.DB.DataSource).CreateConnection(host, port, namespace, user, pwd)
                if 'connection.IsConnected set ERRTXT="NotConnected" quit
                set irisC=connection.CreateIris()

                set theService = irisC.ClassMethodValue("Ens.Director","CreateBusinessService",Ensemble Service Name,.theService)
                //How do I replace the line below to use the IRIS instance I established above?
                set response = theService.OnProcessInput(TRAN,.response)

                do connection.Disconnect()

Everything works great until we try to send the transaction: theService.OnProcessInput(TRAN,.response).  Is there any thing that I can use with the IRIS connection to be able to execute theService.OnProcessInput(TRAN,.response)?

Thank you.




 

Product version: IRIS 2021.2
$ZV: IRIS for Windows (x86-64) 2022.1 (Build 209U) Tue May 31 2022 12:16:40 EDT [Health:3.5.0]
Discussion (3)0
Log in or sign up to continue

Have you tried wrapping your message call (Ens.Director and OnProcessInput) in a class on the target machine.

/// -------- This is on the source machine
/// Source (LIS) Method
ClassMethod ConnectAndCall(host, port, namespace, user, pwd) As %Status
{
    // Our object is defined somewhere
    #dim TRAN As %RegisteredObject = $$$NULLOREF
    Set sc = $$$OK
    // Connect to our HC machine
    set connection = ##class(%Net.DB.DataSource).CreateConnection(host, port, namespace, user, pwd)
    if 'connection.IsConnected set ERRTXT="NotConnected" quit $$$Error($$$GeneralError, "Couldn't connect")
    set irisC=connection.CreateIris()
 
    // Instead of multiple calling with response objects wrap everything on the client
    set response = irisC.ClassMethodValue("Helpers.Ens", "SendMessage", "ServiceName", TRAN)
    do connection.Disconnect()
 
    Return sc
}
 
/// ---------- This is on the target machine
/// healthconnect method (target machine)
/// Classname: "Helpers.Ens.SendMessage()"
ClassMethod SendMessage(servicename, message) As %RegisteredObject
{
    // Find running job of servicename
    Set sc = ##class(Ens.Director).CreateBusinessService(servicename, .serviceHandle)
    // Call that service
    Set sc = serviceHandle.OnProcessInput(message, .response)
    return response
}