Subhajit,

While I am not sure what details are behind your comment that your program 
"just stopped on the line number 4 and not going to the next line", what seems 
to be clear is that an ADT A01 message event is assumed.

A previous reply to your message that seems to recommend checking to determine 
whether "theIn" is an instance of "ADT_A01", although well intentioned, is 
unfortunately not possible since there is no relationship between objects of 
class Message and objects of class ADT_A01 as the HAPI library is currently 
designed.

To determine whether the message is in fact an ADT_A01, you will need to do 
something like the following, unless you decide to modify the HAPI library 
source code:

/*****/
String messageType = null;
String messageEvent = null;
MSH messageHeader = null;

Object obj = null;
try {
    obj =  ( MSH )message.get( "MSH" );
    messageHeader = ( MSH )obj; //message.get( "MSH" );
} catch(ClassCastException e) {
    throw new HL7Exception(e);
}
messageType = messageHeader.getMessageType().getMessageType().getValue();
messageEvent = messageHeader.getMessageType().getTriggerEvent().getValue();
/*****/

Make sure that messageType is "ADT" and messageEvent = "A01" before casting to 
ADT_A01.

Erik


subhajit bhadury <[email protected]> wrote: Hi,
  I am developing a HL7 client application that will just receive hl7 message 
getting from hl7 server. Problem is given below,

1 public Message processMessage(Message theIn) throws ApplicationException, 
HL7Exception {
   
2          encodedMessage = new PipeParser().encode(theIn);
3            System.out.println(encodedMessage);

4            ADT_A01 objADT_01=(ADT_A01) theIn;

5          ACK retVal;
6          try {
               // This method takes in the MSH segment of an incoming message, 
and generates an
              // appropriate ACK
7              retVal = (ACK)DefaultApplication.makeACK(msh);
8          } catch (Exception e) {
 9              throw new HL7Exception(e);
10          }
  
11          return retVal;
12      }


Encoded message is showing fine but my program just stopped on the line number 
4 and not going to the next line. I just wanted to populate objADT_01 object 
and want to extract segment information. I can't understand why. Please help me.
 
Thanks & Regards,
subhajit bhadury.
 ------------------------------------------------------------------------------
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

  

------------------------------------------------------------------------------
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to