Hi Derek,

It's probably as simple as using the get(String) method on your ACK
message. HAPI does store any segments that aren't a part of the "official"
structure, but you need to ask for them by string/name instead of using the
regular accessor.

Message ack = initiator.sendAndReceive(.....);
PID pid = (PID)ack.get("PID");

The following code might be helpful in terms of figuring out where in the
message things have ended up:
System.out.println(ack.printStructure());

Cheers,
James

On Tue, Jul 31, 2012 at 5:33 PM, Derek Mahar <[email protected]>wrote:

> Given a QRY_A19 query message, what approach do you recommend to decompose
> the contents of the response Message from
> "Initiator.sendAndReceive(Message)"?  The debugger reports that the type of
> the response is ACK, but ACK does not offer access to additional segments
> in the message such as PID, ORC, OBR.  Should I treat the contents instead
> as a Structure or Group?  In particular, how might I retrieve the second
> OBR segment in a message that contains a pair of ORC and OBR segments?
>
> References:
>
> Class ACK
>
> http://hl7api.sourceforge.net/v23/apidocs/ca/uhn/hl7v2/model/v23/message/ACK.html
>
> Interface Group
> http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/model/Group.html
>
> Method Initiator.sendAndReceive(Message)
>
> http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/app/Initiator.html#sendAndReceive(ca.uhn.hl7v2.model.Message)
>
> Class Message
>
> http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/app/Initiator.html#sendAndReceive(ca.uhn.hl7v2.model.Message
>
> Class QRY_A19
>
> http://hl7api.sourceforge.net/v23/apidocs/src-html/ca/uhn/hl7v2/model/v23/message/QRY_A19.html
>
> Interface Structure
>
> http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/model/Structure.html
>
> Thank you,
>
> Derek
>
> --
> Derek Mahar
> Senior Software Developer
> Intelerad Medical Systems Incorporated
> 895 de la Gauchetiere W. Suite 400
> Montreal, QC, Canada, H3B 4G1
> Tel: 514.931.6222 x7754
> Fax: 514.931.4653
> [email protected]
> www.intelerad.com
>
>
>
> This email or any attachments may contain confidential or legally
> privileged information intended for the sole use of the addressees. Any
> use, redistribution, disclosure, or reproduction of this information,
> except as intended, is prohibited. If you received this email in error,
> please notify the sender and remove all copies of the message, including
> any attachments.
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Hl7api-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to