From: Bryan T. <bp...@gm...> - 2006-01-10 21:26:46
|
Hi Steve, The message type, event, and possibly structure should be in field MSH-9. Actually if they are there, HAPI should not use the GenericMessage class, and you should be able to tell what kind of message it is from the class. Maybe these data are missing from the message? Bryan On 1/9/06, Steve Pringle <st...@pr...> wrote: > 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 determi= ne > 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 =3D null; > PipeParser parser =3D 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 =3D in.getNames(); > > for (int i =3D 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 > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log fi= les > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick > _______________________________________________ > Hl7api-devel mailing list > Hl7...@li... > https://lists.sourceforge.net/lists/listinfo/hl7api-devel > |