| @@ -8,6 +8,7 @@ import ca.uhn.hl7v2.app.HL7Service; | |||||
| import ca.uhn.hl7v2.app.Initiator; | import ca.uhn.hl7v2.app.Initiator; | ||||
| import ca.uhn.hl7v2.llp.LLPException; | import ca.uhn.hl7v2.llp.LLPException; | ||||
| import ca.uhn.hl7v2.model.Message; | import ca.uhn.hl7v2.model.Message; | ||||
| import ca.uhn.hl7v2.model.v251.message.ACK; | |||||
| import ca.uhn.hl7v2.model.v251.message.ADT_A01; | import ca.uhn.hl7v2.model.v251.message.ADT_A01; | ||||
| import ca.uhn.hl7v2.model.v251.segment.*; | import ca.uhn.hl7v2.model.v251.segment.*; | ||||
| import ca.uhn.hl7v2.parser.Parser; | import ca.uhn.hl7v2.parser.Parser; | ||||
| @@ -128,25 +129,22 @@ public class HL7Sender { | |||||
| Initiator initiator = connection.getInitiator (); | Initiator initiator = connection.getInitiator (); | ||||
| Message response = null; | Message response = null; | ||||
| try { | try { | ||||
| response = initiator.sendAndReceive ( adt ); | |||||
| while (! (response instanceof ACK)) { | |||||
| response = initiator.sendAndReceive ( adt ); | |||||
| Thread.sleep ( 5000 ); | |||||
| } | |||||
| } catch (HL7Exception e) { | } catch (HL7Exception e) { | ||||
| e.printStackTrace (); | e.printStackTrace (); | ||||
| } catch (LLPException e) { | } catch (LLPException e) { | ||||
| e.printStackTrace (); | e.printStackTrace (); | ||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| e.printStackTrace (); | e.printStackTrace (); | ||||
| } | |||||
| /* | |||||
| String responseString = null; | |||||
| try { | |||||
| responseString = p.encode ( response ); | |||||
| } catch (HL7Exception e) { | |||||
| } catch (InterruptedException e) { | |||||
| e.printStackTrace (); | e.printStackTrace (); | ||||
| } | } | ||||
| System.out.println ( "Received response:\n" + responseString ); | |||||
| */ | |||||
| /* | |||||
| /* | |||||
| * Close the connection when you are done with it. | * Close the connection when you are done with it. | ||||
| */ | */ | ||||
| connection.close (); | connection.close (); | ||||