web stats
encapsulate pdf in mirth - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 03-15-2017, 03:43 AM
EDL EDL is offline
What's HL7?
 
Join Date: Mar 2017
Posts: 2
EDL is on a distinguished road
Default encapsulate pdf in mirth

Hi All,

I'm trying to encapsulate pdf in HL7 to send with MLLP (in test mode is set File Writer channel). In input I read pdf stored in SQL DB.

In sours transformers add code find in forum to encapsulate file, but there is a follow error.

In attach the channel export, I use mirth v. 3.4.

Can you help me?

Transformer error
ERROR MESSAGE: Error evaluating transformer
com.mirth.connect.server.MirthJavascriptTransforme rException:
CHANNEL: PROVA PDF
CONNECTOR: sourceConnector
SCRIPT SOURCE:
SOURCE CODE:
56: //var encodedContent = Packages.org.apache.commons.codec.binary.Base64.en codeBase64String(contents);
57:
58: //var contents = FileUtil.readBytes('C:/HL7DOCS/docteste.doc');
59: var encData=FileUtil.encode(Packages.java.lang.String( contents).getBytes());
60:
61: var temp = encData;
62: var index = temp.indexOf("\r\n");
63: while(index != -1){
64: temp = temp.replace("\r\n","&newline;");
65: index = temp.indexOf("\r\n");
LINE NUMBER: 61
DETAILS: TypeError: Character reference "�" is an invalid XML character.
at 37b971ff-c329-46d5-94c2-48a41e8ba7cb:44 (doScript)
at 37b971ff-c329-46d5-94c2-48a41e8ba7cb:93
at com.mirth.connect.server.transformers.JavaScriptFi lterTransformer$FilterTransformerTask.doCall(JavaS criptFilterTransformer.java:154)
at com.mirth.connect.server.transformers.JavaScriptFi lterTransformer$FilterTransformerTask.doCall(JavaS criptFilterTransformer.java:119)
at com.mirth.connect.server.util.javascript.JavaScrip tTask.call(JavaScriptTask.java:113)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker( Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
at java.lang.Thread.run(Unknown Source)
Attached Files
File Type: xml encapsulate_pdf.xml (24.0 KB, 8 views)
Reply With Quote
  #2  
Old 03-23-2017, 01:40 AM
EDL EDL is offline
What's HL7?
 
Join Date: Mar 2017
Posts: 2
EDL is on a distinguished road
Default

Hi to All,

the problem is in reading the data from the db, mirth try to parse the field bimario as XML.

can someone help me?
Reply With Quote
  #3  
Old 03-23-2017, 06:47 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,116
narupley is on a distinguished road
Default

Read in the bytes, then use FileUtil (or some other library) to convert that to Base64. Then either place that in the channel map, or use the addAttachment() method to create an attachment for it. Then make sure your File Writer destination is set to Binary mode.
__________________
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

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 12:19 AM.


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