From: Lalita G. <lg...@ho...> - 2017-08-20 20:24:17
|
I am trying to get your sample code working. I have been able to send a message to a receiver jetty server. The receiver app is produce a response ACK, as follows - (start) MSH - MSH|^~\&|||||20170820153811.821-0500||ACK^A01|14|T|2.5.1 [ { SFT } ] - Not populated MSA - MSA|AA|15 [ { ERR } ] - Not populated ACK (end) But the sending app does not receive this ACK, instead at IReceivable<Message> receivable = client.sendAndReceiveMessage(sendable); the sending app is throwing an exception, as follows: ca.uhn.hl7v2.hoh.api.NonHl7ResponseException: Invalid Content-Type: text/html at ca.uhn.hl7v2.hoh.encoder.AbstractHl7OverHttpDecoder.doReadContentsFromInputStreamAndDecode(AbstractHl7OverHttpDecoder.java:233) at ca.uhn.hl7v2.hoh.encoder.AbstractHl7OverHttpDecoder.readHeadersAndContentsFromInputStreamAndDecode(AbstractHl7OverHttpDecoder.java:541) at ca.uhn.hl7v2.hoh.raw.client.AbstractRawClient.doSendAndReceiveInternal(AbstractRawClient.java:159) at ca.uhn.hl7v2.hoh.raw.client.AbstractRawClient.sendAndReceive(AbstractRawClient.java:279) at ca.uhn.hl7v2.hoh.raw.client.HohRawClientSimple.sendAndReceive(HohRawClientSimple.java:55) at ca.uhn.hl7v2.hoh.hapi.client.AbstractClient.sendAndReceiveMessage(AbstractClient.java:161) at gov.va.mass.adapter.senderapp.App.main(App.java:72) So it appears that the content type is getting messed up. The sendable in the sending app prior to sendAndReceiveMessage call outputs the following : encoding style ER7 and content type application/hl7-v2 Should the response have the same value for these parameters. The receiving app however has no mention of ER7, though it seems to be doing the right thing. Here is what I got my querying the objects on receiving app: Parser class ca.uhn.hl7v2.parser.GenericParser Get encoding VB Supports VB true Supports ER7 false Supports XML true no. of rules 0 getDefaultEncoding VB I was trying to see if there is any way I can set the encoding to ER7. I have found that encoding rules in the parser come from the ValidationContext. So do I need to subclass the ValidationContextImpl, and create an encodingrule. If so how? I have looked for guidance in the docs and other forums. But have reached a dead end on how to proceed. Please help. Please also let me know if I should be doing something totally different. Thanks, Sent from Outlook<http://aka.ms/weboutlook> |