From: Sara F. <sar...@gm...> - 2014-07-22 19:33:33
|
Hi all, I am using this example <http://hl7api.sourceforge.net/hapi-hl7overhttp/doc_hapi.html> to send hl7 message over http. My aim is to send a PIX message to an OpenHIE end point. The message is being send to the below host: - Host: iol.sandbox.ohie.org - Port: 5001 - Basic auth details: - username: admin - password: admin - HTTP method: POST - HTTP Path: /ws/rest/v1/patients/ However at the below line IReceivable<Message> receivable = client.sendAndReceiveMessage(sendable); I am facing an exception. This is the exception which I am facing: ca.uhn.hl7v2.hoh.api.NonHl7ResponseException: Invalid Content-Type: text/plain 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 org.openmrs.module.IHEInteroperability.SendMessageUtility.hl7OverHttp(SendMessageUtility.java:164) at org.openmrs.module.IHEInteroperability.api.impl.IHEInteroperabilityServiceImpl.afterReturning(IHEInteroperabilityServiceImpl.java:79) at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:51) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.openmrs.aop.LoggingAdvice.invoke(LoggingAdvice.java:122) I understand that OpenHIE is expecting the message to be in XML format, so I did the below, //Converting the hl7 message into xml Parser pipeParser = new PipeParser(); String encodedMessage = pipeParser.encode(adt); System.out.println(encodedMessage); pipeParser = new DefaultXMLParser(); String xmlMessage = pipeParser.encode(adt); ISendable sendable = new MessageSendable(xmlMessage); // However here it is expecting a Message object, hence I cannot provide xmlMessage. Could someone guide me how I could resolve this issue? Thanks & Regards Sara Fatima |