From: Davies, B. <Bri...@Mc...> - 2016-02-23 23:41:56
|
Hi Mike, That’s doesn’t seem to be the problem. Neither one of these solves the problem. ADT_A38 adt=new ADT_A38(); adt.initQuickstart("0RR","001","W"); or even msh1.getMsh9_MessageType().getMsg1_MessageCode().setValue("0RR"); msh1.getMsh9_MessageType().getMsg2_TriggerEvent().setValue("001"); msh1.getMsh9_MessageType().getMsg3_MessageStructure().setValue("W"); I think it is indeed related to the content-type not set somewhere. Observe the following: This problem really seems related to the content-type header not set in the http request because AbstractHl7OverHttpDecoder does the following check: for (Map.Entry<String, String> nextEntry : getHeaders().entrySet()) ...... } else if ("content-type".equals(nextHeader)) { myContentType = nextValue.trim(); } public String getContentType() { return myContentType; } Then a check is made for this value and if not set an exception is thrown, so it doesn’t appear to be related to the MSH9 field. if (getContentType() == null) { throw new DecodeException("Content-Type not specified"); } Many thanks Brian. From: Mike Mills [mailto:mi...@th...] Sent: Tuesday, February 23, 2016 1:42 PM To: Davies, Brian Cc: HAPI Devel List Subject: Re: [HAPI-devel] (no subject) Have you tried using initQuickstart() on the adt object? We only use std mllp (ie not over http) but having gone through the receive code for mllp, you must have MSH9 set, which is one of the fields initQuickstart configures. The content type error could just be a side effect of not sending a valid hl7 message? Mike On 24 Feb 2016 2:59 AM, "Davies, Brian" <Bri...@mc...<mailto:Bri...@mc...>> wrote: 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 ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140<http://cp.mcafee.com/d/avndz8w76Qm7T4TT63hOedCQkkQnCkTTQjqaaqbParza9ISrdGSa_iBosKrsuvt5i2qbUHpNZ2W91cluZwQsyH3zZxnn7S1lNB5VB5dOMVRMSrdCPo0dpIxG5e8YxlIwvZzVmaY3s8x3kcIul9igej79If3AnQmww29dDoMyNsSrusudCXCQPrNKVJUSyrh> _______________________________________________ Hl7api-devel mailing list Hl7...@li...<mailto:Hl7...@li...> https://lists.sourceforge.net/lists/listinfo/hl7api-devel<http://cp.mcafee.com/d/FZsSd1MAd2hJ5xZNdZNwQszzpJ55d5VBdZZ4SyyCyYOCUOyrdCPqJyLQFm7bCT7DThkwCy-aSsvgKygj5nLod78GMU_olRNZwlsphuphjsIetsdCPpISjDdqymovaAWtiHsruW01_wrxYGjFxYGjB1SK4PNSHibEupYYSrusudCXCQPrNKVJUSyrh> |