I guess that you are using a Enslib.HL7.Service that uses EnsLib.File.InboundAdapter as Adapter. The problem is that the name of the file is not a property of Enslib.HL7.Message class, so you have to follow these steps:

  1. Create your own service that extends to Enslib.HL7.Service.
  2. Overwritte OnProcessInput process to get the name of the readed stream:
    Set tFileName=pInput.Attributes("Filename")
    set sessionID = $$$JobSessionId
    set ^GlobalName("Session", sessionID) = tFileName
    do ##super()
  3. From DTL use code to get the global that you created before getting the ID session from Enslib.HL7.Message and assign it to MSH property:
  4. Set globalValue = $GET(^GlobalName("Session", sessionID))
    
  5. And finally assign globalValue variable to the MSH propery (using SET from the DTL):
    target.{MSH.PropertyName} = globalValue
     

I'm not very sure that you should extend EnsLib.REST.Service to define a REST service with URLMap, but anyway, EnsLib.REST.Service is using EnsLib.HTTPInbound.Adapter so you can get the input data from OnProcessInput like this:

Method OnProcessInput(pInput As %GlobalCharacterStream, Output pOutput As %RegisteredObject) As %Status
{
     set authorization = pInput.Attributes("authorization")
...

Here is the doc related: https://docs.intersystems.com/healthconnect20251/csp/docbook/DocBook.UI....