web stats
Converting HL7 message to Base64Binary - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 09-06-2012, 07:30 AM
msoor msoor is offline
Mirth Newb
 
Join Date: Aug 2012
Posts: 10
msoor is on a distinguished road
Default Converting HL7 message to Base64Binary

I am new to Mirth and need some help trying to send HL7 message as Base64Binary to a downstream system using Web service Sender connector type.

I have the data coming from the SQL Server and have applied the transformer to convert it to HL7 format. Now I need to convert the HL7 message and then send it via web service. I have tried but not able to figure out where and how can I convert the message. Any help with this matter will be greatly appreciated.

I am using Mirth Connect Server version 2.2.1.5861 built on Feb 28, 2012.

Thanks,
MSoor
Reply With Quote
  #2  
Old 09-06-2012, 08:17 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

It's interesting that your client would need an HL7 message as Base64, since it already should be encoded as ASCII (and binary chunks within the message itself should already be in Base64), but it's certainly possible to do. The simplest way is to use Velocity. First, you'll need to include some sort of encoder in your context. You can do that in a transformer:

Code:
$co('Base64',org.apache.commons.codec.binary.Base64);
Then, just include your Base64-converted message in your destination template (the SOAP Envelope for a Web Service Sender):

Code:
${Base64.encodeBase64String(${message.encodedData.getBytes()})}
NOTE: No charset handling is done there; I'll leave that up to you if it's necessary.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.

Last edited by narupley; 09-06-2012 at 08:19 AM.
Reply With Quote
  #3  
Old 09-06-2013, 09:01 AM
rav rav is offline
Mirth Guru
 
Join Date: Oct 2012
Posts: 258
rav is on a distinguished road
Default

Hi Nick,

How to do the other way round converting base64 to HL7
Reply With Quote
  #4  
Old 09-24-2013, 12:57 PM
cwfowers cwfowers is offline
Mirth Newb
 
Join Date: Sep 2013
Posts: 23
cwfowers is on a distinguished road
Default

So what I want to do is create an HL7 message, and encode it to base64. How do I get the byte array from the HL7 in a transformer?
Reply With Quote
  #5  
Old 09-24-2013, 02:48 PM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

Quote:
Originally Posted by cwfowers View Post
So what I want to do is create an HL7 message, and encode it to base64. How do I get the byte array from the HL7 in a transformer?
To convert a string to a byte array:

Code:
var byteArray = new java.lang.String(yourStringHere).getBytes(charset);
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
Reply

Tags
base64binary, mirth connect

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 09:40 AM.


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