From: Guevara, A. <Ale...@uh...> - 2004-05-25 15:03:24
|
Hi John, In addition to Bryan's response, the code fragments below show how to = create ACK and NACK messages. Alex6 private boolean sendAck( HL7LLPWriter so, String theMessage ) { boolean retVal =3D false; =20 try { //send Response Segment msh =3D myHL7Parser.getCriticalResponseData( = theMessage ); Message ack =3D DefaultApplication.makeACK(msh); String rawAck =3D myHL7Parser.encode(ack); ourLog.debug( "Send ACK : " + rawAck ); so.writeMsg( rawAck ); retVal =3D true; } catch (Exception e) { ourLog.error("Write Response Exception: ", e); } return retVal; } =20 private boolean sendNack( HL7LLPWriter so, String theMessage ) { boolean retVal =3D false; =20 try { //send Response Segment msh =3D myHL7Parser.getCriticalResponseData( = theMessage ); Message nack =3D DefaultApplication.makeACK(msh); =20 //populate MSA and ERR with generic error ...=20 Segment msaSegment =3D (Segment) nack.get("MSA"); Terser.set( msaSegment, 1, 0, 1, 1, "AR" ); Terser.set( msaSegment, 3, 0, 1, 1, "Unable to forward = message to producer" ); //populate ERR segment if it exists (may not depending on version) Structure errSegment =3D nack.get("ERR"); if (errSegment !=3D null) { Segment err =3D (Segment) errSegment; Terser.set(err, 1, 0, 4, 1, "207"); Terser.set(err, 1, 0, 4, 2, "Application Internal = Error"); Terser.set(err, 1, 0, 4, 3, "HL70357"); } =20 String rawAck =3D myHL7Parser.encode(nack); ourLog.debug( "Send NACK : " + rawAck ); so.writeMsg( rawAck ); retVal =3D true; } catch (Exception e) { ourLog.error("Write Response Exception: ", e); } return retVal; } -----Original Message----- From: Tripp, Bryan [mailto:Bry...@uh...]=20 Sent: May 25, 2004 10:55 AM To: 'John Thaemlitz'; Hl7...@li... Subject: RE: [HAPI-devel] Newbie implementing = ca.uhn.hl7v2.app.Application Hi John,=20 You just have to fill in ACK message fields according to whatever specs = you are implementing. For example whether it's an accept or reject depends = on the value of MSA-1. DefaultApplication.makeACK() will get you off to a = good start by filling in all the invariant fields (e.g. ack ID, message = time, message control ID). The rest depends on the results of your = processing and on the system you're interacting with. =20 Regards,=20 Bryan=20 > -----Original Message----- > From: John Thaemlitz [mailto:jo...@rs...] > Sent: May 25, 2004 9:52 AM > To: Hl7...@li... > Subject: [HAPI-devel] Newbie implementing = ca.uhn.hl7v2.app.Application >=20 >=20 > I'm a newbie and a little confused about what the right process is. >=20 > I'm getting my processMessage method called, but I'm not sure how to > construct/return an Ack. What's the basic idea here. I can create a > silly ACK with ACK ack =3D new ACK(); But how do I assing an accept = or > reject ACK. >=20 > Thanks, >=20 > JohnPT >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by: Oracle 10g > Get certified on the hottest thing ever to hit the market...=20 > Oracle 10g.=20 > Take an Oracle 10g class now, and we'll give you the exam FREE. > http://ads.osdn.com/?ad_id149&alloc_id=8166&op=3Dclick > _______________________________________________ > Hl7api-devel mailing list > Hl7...@li... > https://lists.sourceforge.net/lists/listinfo/hl7api-devel >=20 This e-mail may contain confidential and/or privileged information for the sole use of the intended recipient. Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited. If you have received this e-mail in error, please contact = the sender and delete all copies. Opinions, conclusions or other information contained = in this e-mail may not be that of the organization. ------------------------------------------------------- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle = 10g.=20 Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id149&alloc_id=8166&op=3Dclick _______________________________________________ Hl7api-devel mailing list Hl7...@li... https://lists.sourceforge.net/lists/listinfo/hl7api-devel --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.681 / Virus Database: 443 - Release Date: 10/05/2004 =20 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.681 / Virus Database: 443 - Release Date: 10/05/2004 =20 This e-mail may contain confidential and/or privileged information for the sole use of the intended recipient. Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited. If you have received this e-mail in error, please contact = the sender and delete all copies. Opinions, conclusions or other information contained = in this e-mail may not be that of the organization. |