From: Steve P. <st...@pr...> - 2006-01-09 07:27:16
|
Could someone please tell me how one goes about determining what type of message has been received in the Application.processMessage(Message in) method? Here's a code snippet, which is being sent an ADT_A01 msg, but I have no idea how to determine that it is an ADT_A01. All I want to do is determine which message type was sent, get the data I need, then send an ACK. public class ABApplication implements Application { ... public Message processMessage(Message in) throws ApplicationException { Message out = null; PipeParser parser = new PipeParser(); try { System.out.println("\nmsg Name: " + in.getName()); System.out.println("\nmsg Name: " + in.getClass().getName()); System.out.println("\nmsg Version: " + in.getVersion()); System.out.println("\nmsg ?: " + in.get("MSH").getName()); String[] names = in.getNames(); for (int i = 0; i < names.length; i++) System.out.println("** " + names[i]); ... Here's the output: msg Name: GenericMessage$V22 msg Name: ca.uhn.hl7v2.model.GenericMessage$V22 msg Version: 2.2 msg ?: MSH ** MSH ** EVN ** PID ** NK1 ** PV1 Thanks, Steve PRingle |