This topic contains 3 replies, has 3 voices, and was last updated by  Can 1 year, 8 months ago.

Get Message Text

  • In our system the channels are setup to be decoupled, we save the iguana message id when a message is received. Is there any way we can lookup the original message text from the destination channel translator using the message id assigned in the source channel? Kind of like a resubmit but instead of resubmitting the message it would return the message instead?

    Thanks!

    I don’t know if this is what you’re after, but we based this off some code examples we got from iNTERFACEWARE. We pass the message ID to this function and it returns the message from the Iguana logs. In my understanding, there’s no real separation between logs from one channel or another; it’s all one log, and when we view it by channel, that’s a display filter working. Now, we use this to pull the message from the logs so we can modify the values in MSH.10 and MSH.7 before resubmitting, but I imagine once you have the messages, it should be easy enough to do whatever you need with it.

    function getMessage(refid)
    readLogs = {}
    
       local url = 'http://localhost:'..
       iguanaconfig.config().iguana_config.web_config.port..'/api_query'
    
       local X = net.http.get{url=url
       , parameters={username = 'admin'
       , password = '<something>'
       , source=source
       , includesourcelogs=true
       , type = 'messages'
       , refmsgid = tostring(refid)
       },live=true, }
    
       x = tostring(xml.parse{data=X}.export.message.data)
    
       return x
    
    end --end getMessage()

    -Robert James,
    Interface Analyst,
    GetWellNetwork, Inc.

    Thanks Robert. I was hoping there would be a more direct way, like iguana.GetMessage or similar. I think I can make this work though. Thanks for the share

    Hello Robert,

    I have tried your code but I am getting the following error.

    [string “main”]:191: attempt to index global ‘iguanaconfig’ (a nil value)

    I guess I need to use the readLogs{} module?

    Thannks
    Can

You must be logged in to reply to this topic.