web stats
Mirth Community - View Single Post - Converting HL7 message to Base64Binary
View Single Post
  #2  
Old 09-06-2012, 07:17 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,111
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 07:19 AM.
Reply With Quote