[英]Hapi encoding HL7 v2.7 message into xml using Hapi XML Parser
Hapi xml parser is giving following exception while encoding the HL7 v2.7 message using Hapi Xml Parser. 使用Hapi Xml分析器对HL7 v2.7消息进行编码时,Hapi xml分析器给出以下异常。
ca.uhn.hl7v2.HL7Exception: Can't XML-encode a GenericMessage. ca.uhn.hl7v2.HL7Exception:无法XML编码GenericMessage。 Message must have a recognized structure. 邮件必须具有公认的结构。
Below is my code snippet that i am using to encode message 以下是我用来编码消息的代码段
HapiContext context = new DefaultHapiContext(modelClassFactory)
PipeParser pipeParser = context.getPipeParser();
pipeParser.setValidationContext(new NoValidation());
pipeParser.getParserConfiguration().setAllowUnknownVersions(true);
Message msg = pipeParser.parse(document);
Parser xmlParser = context.getXMLParser();
return xmlParser.encode(msg);
Any suggestion/solutions? 有什么建议/解决方案吗?
This exception is thrown if the message you try to encode has no specific type but is a GenericMessage
instead. 如果您尝试编码的消息没有特定类型,而是GenericMessage
则抛出此异常。 It seems as if HAPI cannot determine the right message type for your document
. 似乎HAPI无法为您的document
确定正确的消息类型。 If you increase the log level of HAPI to DEBUG
, it might give you a clue why the PipeParser
cannot create an instance of a specific message type. 如果将HAPI的日志级别提高到DEBUG
,则可能会为您提供线索,说明PipeParser
为什么无法创建特定消息类型的实例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.