[HAPI-devel] How can I handle malformed messages?

2013-06-11 Thread Eugene Berman
One of the use cases that I need to deal with is to return a NACK in response to malformed messages. For example, if I send an XML message that cannot be parsed by the HAPI parser, the exception will be thrown, but then I need to generate a NACK and return it to the client. My question is, how c

Re: [HAPI-devel] How can I handle malformed messages?

2013-06-11 Thread Christian Ohr
Hi Eugene, It certainly depends on how malformed the message is. If you are able to parse out minimal data required for a qualified response (i.e. the MSH segment is somehow valid), you have Parser#getMinimalResponseData that returns a MSH segment that can be used for your response. If you are usi

Re: [HAPI-devel] How can I handle malformed messages?

2013-06-11 Thread Eugene Berman
Thanks a lot, Christian, that's pretty much what I did - my malformed messages had broken MSH, so I got some inspiration from an old Mirth code and came up with some regex parser that tries to extract as much info as possible from the MSH, and uses "default" values where headers from the incomin