This is another reason for RESTWS-184<https://tickets.openmrs.org/browse/RESTWS-184>(submit HL7 messages as body of post without JSON wrapper) -- e.g., HL7 messages must be escaped, the line separator in HL7 is ASCII 13 (not ASCII 10 or ASCII 13+ASCII 10), etc.
-Burke On Tue, Aug 9, 2011 at 1:40 PM, Darius Jazayeri <[email protected]>wrote: > Hi Jeff, > > I can't find the bug report in JIRA. Can you point me to the ticket number > there? > > I tried out the command below on the 1.8.1-with-WS standalone, and I got > an error message including "Could not read JSON: Unrecognized character > escape (\\ followed by '&' (code 38))". > > So I added an extra slash (i.e. ^~\& -> ^~\\&), tried again, and it worked > fine. Can you try that? > > $ echo '{ "source":"LOCAL", >> "sourceKey|^~\\&|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"}' | curl -i -X >> POST -H"Content-Type: application/json" -u admin:Admin123 -d@- >> http://localhost:8082/openmrs-standalone/ws/rest/v1/hl7 >> HTTP/1.1 201 Created >> >> Server: Apache-Coyote/1.1 >> Set-Cookie: JSESSIONID=DC56480E7CB6AD6906E49B30B49F3D56; >> Path=/openmrs-standalone >> ETag: "03e51ca032b741a166fb3ed18a7842800" >> >> Content-Type: application/json;charset=UTF-8 >> Content-Length: 267 >> Date: Tue, 09 Aug 2011 17:36:33 GMT >> >> {"uuid":"792474fd-05c2-485d-bcd2-dc83cf0cd984","messageState":0,"links":[{"uri":"NEED-TO-CONFIGURE/ws/rest/v1/hl7/792474fd-05c2-485d-bcd2-dc83cf0cd984","rel":"self"},{"uri":"NEED-TO-CONFIGURE/ws/rest/v1/hl7/792474fd-05c2-485d-bcd2-dc83cf0cd984?v=full","rel":"full"}]} > > > -Darius > > > On Tue, Aug 9, 2011 at 9:24 AM, Price, Jeff M. <[email protected]> wrote: > >> Hi ,**** >> >> ** ** >> >> I am still trying to get an HL7 message into openMRS using WS.**** >> >> djazayeri has been extremely helpful, but I have not been able to >> get it to work. **** >> >> It is probably something I am doing wrong. He suggested I file a bug >> report since it was a 500 series http error which I did. **** >> >> I am posting here just in case anyone else has any other ideas on what I >> might try because this is in the critical path of my project.**** >> >> ** ** >> >> Thank you for any assistance.**** >> >> ** ** >> >> Jeff **** >> >> (feel free to email me directly if you want [email protected])**** >> >> ** ** >> >> ** ** >> >> ** ** >> >> ** ** >> >> I am using standalone version : 1.8.1-stable-with-WS-alpha**** >> >> ** ** >> >> What I tried is below :**** >> >> ** ** >> >> echo '{**** >> >> "source":"LOCAL", **** >> >> "sourceKey":"test", **** >> >> >> >> "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**** >> >> "}' | curl -i -X POST -H"Content-Type: application/json" -u >> admin:Admin123 -d@- >> http://127.0.0.1:8081/openmrs-standalone/ws/rest/v1/hl7**** >> >> ** ** >> >> ** ** >> >> ** ** >> >> The resulting error was:**** >> >> ** ** >> >> ** ** >> >> HTTP/1.1 500 Internal Server Error**** >> >> Server: Apache-Coyote/1.1**** >> >> Set-Cookie: JSESSIONID=1C507281640518591912B2F157B2030D; >> Path=/openmrs-standalone**** >> >> Content-Type: application/json;charset=UTF-8**** >> >> Content-Length: 11054**** >> >> Date: Tue, 09 Aug 2011 00:38:07 GMT**** >> >> Connection: close**** >> >> ** ** >> >> {"error":{"message":"Unable to convert object into response >> content","code":"org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource:293","detail":"org.openmrs.module.webservices.rest.web.response.ConversionException: >> source on class >> org.openmrs.module.webservices.rest.web.util.IncomingHl7Message\r\n\tat >> org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource.setProperty(BaseDelegatingResource.java:293)\r\n\tat >> org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource.setConvertedProperties(BaseDelegatingResource.java:202)\r\n\tat >> org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource.create(DelegatingCrudResource.java:87)\r\n\tat >> org.openmrs.module.webservices.rest.web.v1_0.controller.BaseCrudController.create(BaseCrudController.java:84)\r\n\tat >> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat >> sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)\r\n\tat >> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)\r\n\tat >> java.lang.reflect.Method.invoke(Unknown Source)\r\n\tat >> org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)\r\n\tat >> org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426)\r\n\tat >> org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414)\r\n\tat >> org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)\r\n\tat >> org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)\r\n\tat >> org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)\r\n\tat >> org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)\r\n\tat >> javax.servlet.http.HttpServlet.service(HttpServlet.java:637)\r\n\tat >> javax.servlet.http.HttpServlet.service(HttpServlet.java:717)\r\n\tat >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)\r\n\tat >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\r\n\tat >> org.openmrs.module.web.filter.ForcePasswordChangeFilter.doFilter(ForcePasswordChangeFilter.java:65)\r\n\tat >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)\r\n\tat >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\r\n\tat >> org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:76)\r\n\tat >> org.openmrs.module.webservices.rest.web.filter.AuthorizationFilter.doFilter(AuthorizationFilter.java:100)\r\n\tat >> org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:74)\r\n\tat >> org.springframework.web.filter.ShallowEtagHeaderFilter.doFilterInternal(ShallowEtagHeaderFilter.java:58)\r\n\tat >> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)\r\n\tat >> org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:74)\r\n\tat >> org.openmrs.module.xforms.web.XformsFilter.doFilter(XformsFilter.java:60)\r\n\tat >> org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:74)\r\n\tat >> org.openmrs.module.web.filter.ModuleFilter.doFilter(ModuleFilter.java:58)\r\n\tat >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)\r\n\tat >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\r\n\tat >> org.openmrs.web.filter.OpenmrsFilter.doFilterInternal(OpenmrsFilter.java:112)\r\n\tat >> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)\r\n\tat >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)\r\n\tat >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\r\n\tat >> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)\r\n\tat >> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)\r\n\tat >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)\r\n\tat >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\r\n\tat >> org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:83)\r\n\tat >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)\r\n\tat >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\r\n\tat >> org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:83)\r\n\tat >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)\r\n\tat >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\r\n\tat >> org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:83)\r\n\tat >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)\r\n\tat >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\r\n\tat >> org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)\r\n\tat >> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)\r\n\tat >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)\r\n\tat >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\r\n\tat >> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)\r\n\tat >> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)\r\n\tat >> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)\r\n\tat >> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)\r\n\tat >> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)\r\n\tat >> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)\r\n\tat >> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)\r\n\tat >> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)\r\n\tat >> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)\r\n\tat >> java.lang.Thread.run(Unknown Source)\r\nCaused by: >> org.hibernate.NonUniqueResultException: query did not return a unique >> result: 2\r\n\tat >> org.hibernate.impl.AbstractQueryImpl.uniqueElement(AbstractQueryImpl.java:820)\r\n\tat >> org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:305)\r\n\tat >> org.openmrs.hl7.db.hibernate.HibernateHL7DAO.getHL7SourceByName(HibernateHL7DAO.java:88)\r\n\tat >> org.openmrs.hl7.impl.HL7ServiceImpl.getHL7SourceByName(HL7ServiceImpl.java:197)\r\n\tat >> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat >> sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)\r\n\tat >> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)\r\n\tat >> java.lang.reflect.Method.invoke(Unknown Source)\r\n\tat >> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)\r\n\tat >> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)\r\n\tat >> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)\r\n\tat >> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)\r\n\tat >> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)\r\n\tat >> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)\r\n\tat >> $Proxy552.getHL7SourceByName(Unknown Source)\r\n\tat >> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat >> sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)\r\n\tat >> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)\r\n\tat >> java.lang.reflect.Method.invoke(Unknown Source)\r\n\tat >> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)\r\n\tat >> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)\r\n\tat >> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)\r\n\tat >> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)\r\n\tat >> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)\r\n\tat >> org.openmrs.aop.LoggingAdvice.invoke(LoggingAdvice.java:114)\r\n\tat >> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)\r\n\tat >> org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:50)\r\n\tat >> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)\r\n\tat >> org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:50)\r\n\tat >> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)\r\n\tat >> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)\r\n\tat >> $Proxy553.getHL7SourceByName(Unknown Source)\r\n\tat >> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat >> sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)\r\n\tat >> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)\r\n\tat >> java.lang.reflect.Method.invoke(Unknown Source)\r\n\tat >> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)\r\n\tat >> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)\r\n\tat >> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)\r\n\tat >> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)\r\n\tat >> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)\r\n\tat >> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)\r\n\tat >> $Proxy553.getHL7SourceByName(Unknown Source)\r\n\tat >> org.openmrs.module.webservices.rest.web.v1_0.resource.HL7SourceResource.getByUniqueId(HL7SourceResource.java:39)\r\n\tat >> org.openmrs.module.webservices.rest.web.v1_0.resource.HL7SourceResource.getByUniqueId(HL7SourceResource.java:30)\r\n\tat >> org.openmrs.module.webservices.rest.web.ConversionUtil.convert(ConversionUtil.java:160)\r\n\tat >> org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource.setProperty(BaseDelegatingResource.java:289)\r\n\t... >> 63 more\r\n"}}**** >> >> ** ** >> >> *Jeff Price * >> >> West Wireless Health Institute <http://www.westwirelesshealth.org/> **** >> >> Principal Systems Enginner**** >> >> [email protected] **** >> >> (858) 535-7000 / TEL **** >> >> (858) 412-8639 / DIRECT**** >> >> (858)-361-5751 / CELL**** >> >> ** ** >> ------------------------------ >> Click here to >> unsubscribe<[email protected]?body=SIGNOFF%20openmrs-implement-l>from >> OpenMRS Implementers' mailing list > > > ------------------------------ > Click here to > unsubscribe<[email protected]?body=SIGNOFF%20openmrs-implement-l>from > OpenMRS Implementers' mailing list > _________________________________________ To unsubscribe from OpenMRS Implementers' mailing list, send an e-mail to [email protected] with "SIGNOFF openmrs-implement-l" in the body (not the subject) of your e-mail. [mailto:[email protected]?body=SIGNOFF%20openmrs-implement-l]

