From: Davies, B. <Bri...@Mc...> - 2016-02-23 17:02:17
|
Hi All, I am using the HAPI HohClientSimple client to send a simple HL7 message to some HTTP endpoint but have been encountering an issue with it. I constantly get an exception relating to the content-type of the message. Initially I had set up an embedded Jetty server and I got this message. I had also set up a simple servlet to receive messages posted from the HohClientSimple client. Initally, I suspected I was getting the exception because of Jetty, so I eliminated the Jetty piece and find even with a simple direct post to a servlet, I still get this exception. Please be aware that the message gets posted to the servlet. I even proceeded to set up a separate standalone web application to eliminate issues of a 3rd party library doing any translation. However, I still got the exception on the client as follows: 0:14:47.627 INFO [main][ca.uhn.hl7v2.hoh.util.VersionLogger] HL7 over HTTP (HAPI) library version 2.2 - Build 932 (2014-03-04 20:34:45) ca.uhn.hl7v2.hoh.api.DecodeException: Content-Type not specified at ca.uhn.hl7v2.hoh.encoder.AbstractHl7OverHttpDecoder.doReadContentsFromInputStreamAndDecode(AbstractHl7OverHttpDecoder.java:230) 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 com.mckesson.mms.ecb2b.hl7.message.post.handler.MainTest.main(MainTest.java:35) Here is the MainTest client which simple posts to a servlet hosted on Tomcat, you cannot get any simpler than this: HohClientSimple client = new HohClientSimple("localhost",8080 ," /appcontext/tests/test",PipeParser.getInstanceWithNoValidation()); ADT_A38 adt=new ADT_A38(); MSH msh1=adt.getMSH(); msh1.getMsh1_FieldSeparator().setValue("|"); msh1.getMsh2_EncodingCharacters().setValue("^~\\&"); msh1.getMsh10_MessageControlID().setValue("0944553"); msh1.getMsh11_ProcessingID().getProcessingID().setValue("W"); msh1.getMsh12_VersionID().getVersionID().setValue("2.5"); msh1.getMsh3_SendingApplication().getHd1_NamespaceID().setValue("LEXMA"); msh1.getMsh5_ReceivingApplication().getNamespaceID().setValue("ASD"); SFT sft=adt.getSFT(); adt.insertSFT(sft, 0); DB1 db1=adt.getDB1(); db1.getDisabledPersonCode().setValue("ABLD"); adt.insertDB1(db1, 0); ISendable sendable = new MessageSendable(adt); client.sendAndReceiveMessage(sendable); You can see that the data is posted to the servlet as in the output below: Here is the output from the server side: Received Message !!!! MSH|^~\&|LEXMA||ASD|||||0944553|W|2.5 DB1||ABLD Why am I getting this error? Shouldn't the HohClientSimple be setting the content type? I'd appreciate feedback as this is a critical issue for me. I'm Many thanks, Brian Davies |