Hello,

I have written a class that extends ca.uhn.hl7v2.app.Application. I have implemented the ProcessMessage() method. I initialize everything as follows:

LowerLayerProtocol llp = LowerLayerProtocol.makeLLP(); // The transport protocol PipeParser parser = new PipeParser(new CanonicalModelClassFactory("2.6")); // The message parser
       parser.setValidationContext(new  NoValidation());
       HL7Listener = new SimpleServer(PORT, llp, parser);
       Application handler = new HL7ListenerApp();
       HL7Listener.registerApplication("*", "*", handler);
       HL7Listener.start();

I am working with a new system and we get bad messages that HAPI cannot parse. For example, we get ADT-A08 messages where the MSH has no VersionId, which causes issues :) They are meant for custom software that is not really proper HL7. I want to ignore those, but my problem is that HAPI bails out before i even get a chance to handle the error in my ProcessMessage() method.

ca.uhn.hl7v2.HL7Exception: Can't find version ID - MSH has only 10 fields.
    at ca.uhn.hl7v2.parser.PipeParser.getVersion(PipeParser.java:965)
    at ca.uhn.hl7v2.parser.Parser.parse(Parser.java:164)
    at ca.uhn.hl7v2.parser.PipeParser.parse(PipeParser.java:885)

Is there a way to catch that exception and return a custom ACK?


------------------------------------------------------------------------
*Laurent (Harry) Hasson*
Co-Founder, 360Fresh.com <https://360Fresh.com>

This email and any attachments thereto may contain private, confidential, and privileged material for the sole use of the intended recipient. Any review, copying, or distribution of this email (or any attachments thereto) by others is strictly prohibited. If you are not the intended recipient, please contact the sender immediately and permanently delete the original and any copies of this email and any attachments thereto.

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to