Announcement

Collapse
No announcement yet.

Converting HL7 message to Base64Binary

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #2
    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.
    Last edited by narupley; 09-06-2012, 07:19 AM.
    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.

    Comment


    • #3
      Hi Nick,

      How to do the other way round converting base64 to HL7

      Comment


      • #4
        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?

        Comment


        • #5
          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.

          Comment

          Working...
          X