Encode PDF into Base-64 for ORU Message.

jeudi 1 janvier 2015

Hi,



I am using Mirth Connect 3.1.1.7461.

I have created 1 channel which reads 1 XML file from smb location. In XML file path of one PDF is given. I want to create HL7 ORU message from XML file and also encode the pdf file into Base-64 and store it into OBX-5.1 Segment.



I am using below methods to encode PDF file into Base-64



var fileConn = new com.mirth.connect.connectors.file.filesystems.SmbF ileConnection(strHost, strUsername, strPassword, count);



var inputStream = fileConn.readFile(strFileName,strDirectory);



var strText = org.apache.commons.io.IOUtils.toString(inputStream );



var encData = FileUtil.encode(new java.lang.String(strText).getBytes()).replaceAll(' \\s','');



And I am storing this encoded message into OBX - 5.1 Segment.

It is working and ORU message is being generated.



But while validating ORU message - It is giving error as Length of OBX-5.1 is 65536 and after encoding PDF file into Base-64, It is exceeding this length limit.



Am I using right method to encode pdf file into Base-64?

Can anyone have an idea how to solve this?



Thanks.





Encode PDF into Base-64 for ORU Message.

0 commentaires:

Enregistrer un commentaire