web stats
Reading Raw Attachment - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 06-12-2019, 12:48 PM
bdearlove bdearlove is offline
Mirth Newb
 
Join Date: Apr 2007
Posts: 15
bdearlove
Default Reading Raw Attachment

Good Day All,
In one destination I am using document writer to create a RTF attachment. In the second channel I am looking to read that attachment as raw data to OBR.5. I'm using:

$('d1').getMessage() but it is showing as:

${ATTACH:24617861-3d0a-47b0-85ab-def151308506}

which is not processing correctly on the customer side. Wondering if anyone knows exactly what I am doing wrong, thanks!
Reply With Quote
  #2  
Old 06-12-2019, 01:45 PM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 894
agermano is on a distinguished road
Default

The attachment token still shows in the SENT content for the message, but it is actually replaced in the outgoing message.

You can test that by sending it in a channel writer to another channel on your mirth box.

The receiving channel should get the RTF file instead of the token.

I don't play with the document writer much, but you may need to base64 encode your attachment before sticking it in an hl7 message.
Reply With Quote
  #3  
Old 06-12-2019, 02:02 PM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 894
agermano is on a distinguished road
Default

I just tried it, and it did the base64 encoding automatically. In a second destination I created an xml message and added $('d1').getMessage() as an element, then sent it via channel writer to another channel. My sent content in the original channel shows as
Code:
CHANNEL ID: dec2d4fe-af90-4fdd-86cf-c010da0962d4

[MAP VARIABLES]

[CONTENT]
<xml><attachment>${ATTACH:9db45a88-bd11-470c-895f-5589aeb8960d}</attachment></xml>
In the receiving channel the raw content looks like

Code:
<xml><attachment>long base64 string</attachment></xml>
I was able to decode it and get back to the original rtf.
Reply With Quote
  #4  
Old 06-12-2019, 02:03 PM
bdearlove bdearlove is offline
Mirth Newb
 
Join Date: Apr 2007
Posts: 15
bdearlove
Default

Thanks. When I send to a non-Mirth destination it isn't being replaced. I'm looking at saving to a file first then reading the contents instead, seems to be working except for encoding which i'm working on.
Reply With Quote
  #5  
Old 06-12-2019, 02:41 PM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 894
agermano is on a distinguished road
Default

It does get replaced. That's the purpose of attachments. I just tried it again with a TCP sender sending to a nc listener on a different host (so not mirth.) It looks the same. You don't see it replaced in the sent content on the mirth side, but it does get replaced at the remote end.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 04:31 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation