Send DICOM via HTTP Sender with custom body #4572
Unanswered
alliedarmour
asked this question in
Q&A
Replies: 2 comments 5 replies
-
I think you have to share your http receiver code to answer that question since that defines how post to it. The fact it is DICOM is mostly irrelevant here. Although I might expect DICOM images sizes to be large enough to require chunking, but I'll defer to others here on that part. |
Beta Was this translation helpful? Give feedback.
1 reply
-
For posting multipart form data you have to do something like this, obviously I have some vars set elsewhere in the below earlier in the channel and I am using an attachment handler for the pdf itself. $c('boundary','--------'+UUIDGenerator.getUUID())
var pdfContent = getAttachments(true).get(0).getContent();
var entity = org.apache.http.entity.mime.MultipartEntityBuilder
.create()
.addTextBody('patient', $('fn_mrn'))
.setBoundary($('boundary'))
.addTextBody('description', 'Consolidated Evidence of Care')
.setBoundary($('boundary'))
.addTextBody('metatags', '["Some Documents"]')
.setBoundary($('boundary'))
.addTextBody('doctor', $('provider_external_id'))
.setBoundary($('boundary'))
.addTextBody('date', $c('billing_period_end_datetime'))
.setBoundary($('boundary'))
.addTextBody('document', $('fn'))
.setBoundary($('boundary'))
.addBinaryBody('document', pdfContent, org.apache.http.entity.ContentType.create('application/octet-stream'), $('fn'))
.build();
var bos = new java.io.ByteArrayOutputStream();
entity.writeTo(bos);
msg = FileUtil.encode(bos.toByteArray());
|
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm relatively new to mirth and we're developing kind of a data warehouse for DICOM files and metadata. I've set up my API and now I want to send local stored DICOM images via the HTTP Sender.
Sending the file as form data seems to work, but is it possible to change the request body according to my specifications in the API?
For example I expect the following format:
{ "dicom": { "dicom_file": **Encoded DICOM FIle here** } }
I tried it with setting the content in the channel destination like this
{ "dicom": { "dicom_file": "${message.rawData}" } }
but it seems that the structure was ignored, at on my API Endpoint I just received the multipart file.Thanks for any help!
Beta Was this translation helpful? Give feedback.
All reactions