Re: struggle with hl7 post to openmrs through ws

3 views
Skip to first unread message
Message has been deleted

Darius Jazayeri

unread,
Nov 13, 2014, 8:57:08 PM11/13/14
to dev
A first step would be to share the complete error message. (It cuts off after "Can't parse message beginning".)

-Darius

On Thu, Nov 13, 2014 at 2:21 PM, ttk <you....@gmail.com> wrote:
using the following command to post an file to my openmrs server (1.9), REST version 2.6.9.

curl -i -u admin:Admin123 -X POST --data hl7_post.txt http://127.0.0.1:8080/openmrs/ws/rest/v1/hl7

the hl7_post.txt file is (between "=="): 
==
MSH|^~\&|OpenMRSRadiologyModule|OpenMRS|||132502||ORM^O01||P|2.3||||||encoding|
PID|||100-8||Mr.^John^D^Patient||19750101|M||||||||
ORC|NW|15|||||^^^20141121^^S||||||
OBR||||null|||||||||||||||15|15||||CR||||||||||||||||||||null|
==

The error message is like the following.

HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=35DE1E8FD872CD7E9E814471FA8AB882; Path=/openmrs
Content-Type: application/json;charset=UTF-8
Content-Length: 6607
Date: Thu, 13 Nov 2014 22:16:01 GMT
Connection: close
{"error":{"message":"Unable to convert object into response content","code":"org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_8.HL7MessageController1_8:96","detail":"org.openmrs.module.webservices.rest.web.response.ConversionException: Can't parse message beginning



Don't know what's wrong. Any help will be great.


--
OpenMRS Developers: http://om.rs/dev
Post: d...@openmrs.org | Unsubscribe: dev+uns...@openmrs.org
Manage your OpenMRS subscriptions at http://om.rs/id
 
Register today for our Maputo 2015 Implementers Meeting: http://om.rs/moz15

ttk

unread,
Nov 14, 2014, 10:00:24 AM11/14/14
to d...@openmrs.org
Did not find the edit button to edit my post.

The following is the error message from curl. Thanks for your time.

ttk

{"error":{"message":"Unable to convert object into response content","code":"org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_8.HL7MessageController1_8:96","detail":"org.openmrs.module.webservices.rest.web.response.ConversionException: Can't parse message beginning new.txt\n\tat org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_8.HL7MessageController1_8.create(HL7MessageController1_8.java:96)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.lang.reflect.Method.invoke(Method.java:622)\n\tat org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)\n\tat org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426)\n\tat org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414)\n\tat org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)\n\tat org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)\n\tat org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)\n\tat org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:637)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:717)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\n\tat org.op{"sourceKey":"4XaL1KXdqL2T4Xbj4kZM", "data":"MSH|^~\&|FORMENTRY|AMRS.ELD|HL7LISTENER|AMRS.ELD|20110805104142||ORU^R01|REl7wt78q9Pzlqe9ecJB|P|2.5|1||||||||3^AMRS.ELD.FORMID PID|||3^^^^||Patient^John^D|| PV1||O|1||||1|||||||||||||||||||||||||||||||||||||20110805|||||||V ORC|RE||||||||20110805104141|1^Super User OBR|1|||1238^MEDICAL RECORD OBSERVATIONS^99DCT OBX|1|NM|5089^WEIGHT (KG)^99DCT||67.2|||||||||20110805"}

Darius Jazayeri

unread,
Nov 14, 2014, 10:17:24 AM11/14/14
to dev
Hi ttk,

The error message says
Can't parse message beginning new.txt

Are you sure you're using the right syntax with curl? Could it be posting the filename instead of the file content?

-Darius

ttk

unread,
Nov 14, 2014, 10:26:03 AM11/14/14
to d...@openmrs.org
Really sorry about the wrong error message:

The hl7 message was sent to my dcm4che server, which added an mwl order successfully.

command line used:
curl -i -u admin:Admin123 -X POST --data hl7_post.txt http://127.0.0.1:8080/openmrs/ws/rest/v1/hl7

hl7_post.txt (all in one line with \r) :
==
MSH|^~\&|OpenMRSRadiologyModule|OpenMRS|||132502||ORM^O01||P|2.3||||||encoding|\rPID|||100-8||Mr.^John^D^Patient||19750101|M||||||||\rORC|NW|15|||||^^^20141121^^S||||||\rOBR||||null|||||||||||||||15|15||||CR||||||||||||||||||||null|
==

Error message:
:~/www/openrms$ curl -i -u admin:Admin123 -X POST --data hl7_post.txt http://127.0.0.1:8080/openmrs/ws/rest/v1/hl7

HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=77E4A12C95E8D3B0112D0312E96F2EEA; Path=/openmrs

Content-Type: application/json;charset=UTF-8
Content-Length: 6607
Date: Fri, 14 Nov 2014 15:20:36 GMT
Connection: close
{"error":{"message":"Unable to convert object into response content","code":"org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_8.HL7MessageController1_8:96","detail":"org.openmrs.module.webservices.rest.web.response.ConversionException: Can't parse message beginning \n\tat org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_8.HL7MessageController1_8.create(HL7MessageController1_8.java:96)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.lang.reflect.Method.invoke(Method.java:622)\n\tat org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)\n\tat org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426)\n\tat org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414)\n\tat org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)\n\tat org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)\n\tat org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)\n\tat org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:637)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:717)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\n\tat org.openmrs.module.web.filter.ForcePasswordChangeFilter.doFilter(ForcePasswordChangeFilter.java:65)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\n\tat org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:76)\n\tat org.openmrs.module.xforms.web.XformsFilter.doFilter(XformsFilter.java:60)\n\tat org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:74)\n\tat org.openmrs.web.filter.GZIPFilter.doFilterInternal(GZIPFilter.java:59)\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)\n\tat org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:74)\n\tat org.openmrs.module.webservices.rest.web.filter.AuthorizationFilter.doFilter(AuthorizationFilter.java:108)\n\tat org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:74)\n\tat org.springframework.web.filter.ShallowEtagHeaderFilter.doFilterInternal(ShallowEtagHeaderFilter.java:58)\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)\n\tat org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:74)\n\tat org.openmrs.module.web.filter.ModuleFilter.doFilter(ModuleFilter.java:58)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\n\tat org.openmrs.web.filter.OpenmrsFilter.doFilterInternal(OpenmrsFilter.java:111)\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\n\tat org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\n\tat org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:109)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\n\tat org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:109)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\n\tat org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:109)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\n\tat org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\n\tat org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)\n\tat org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)\n\tat org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)\n\tat org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)\n\tat org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)\n\tat org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)\n\tat org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)\n\tat org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)\n\tat org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)\n\tat java.lang.Thread.run(Thread.java:701)\nCaused by: ca.uhn.hl7v2.parser.EncodingNotSupportedException: Can't parse message beginning \n\tat ca.uhn.hl7v2.parser.Parser.parse(Parser.java:140)\n\tat org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_8.HL7MessageController1_8.create(HL7MessageController1_8.java:80)\n\t... 63 more\n"}}

Reply all
Reply to author
Forward
0 new messages