Written by

Question Suzy Green · 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]

Comments

Nicholai Mitchko · Aug 10, 2022

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

ClassMethodConnectAndCall(host, port, namespace, user, pwd) As%Status

{
    // Our object is defined somewhere
    #dimTRANAs%RegisteredObject = $$$NULLOREF
    Setsc = $$$OK
    // Connect to our HC machine
    setconnection = ##class(%Net.DB.DataSource).CreateConnection(host, port, namespace, user, pwd)
    if 'connection.IsConnectedsetERRTXT="NotConnected"quit$$$Error($$$GeneralError, "Couldn't connect")
    setirisC=connection.CreateIris()

 

    // Instead of multiple calling with response objects wrap everything on the client
    setresponse = irisC.ClassMethodValue("Helpers.Ens", "SendMessage", "ServiceName", TRAN)
    doconnection.Disconnect()

 

    Returnsc
}

 

///---------- This is on the target machine
/// healthconnect method (target machine)
///Classname: "Helpers.Ens.SendMessage()"
ClassMethodSendMessage(servicename, message) As%RegisteredObject
{
    // Find running job of servicename
    Setsc = ##class(Ens.Director).CreateBusinessService(servicename, .serviceHandle)
    // Call that service
    Setsc = serviceHandle.OnProcessInput(message, .response)
    returnresponse
}
0
Suzy Green · Aug 10, 2022

That works great.  Thank you for pointing me in the right direction.

0
Nicholai Mitchko  Aug 10, 2022 to Suzy Green

Glad it worked! Good luck with your project :)

0