ADT Admit Patient - Pipe and Hat format - Synchronous

Black Box View

Overview

The scenario shows a simple synchronous interaction between sender and receiver, as previously described in the SMSP examples. This example is drawn out to show how the ITK Reference Implementation manages the transmission of messages in non-xml format. In this case an HL7v2 ADT message in traditional "pipe and hat" format is packaged up and sent over the wire with no implications for the sending application and very little configuration. Although not shown here, the implications for the receiver are similarly simple.

Sender View

The Sender builds a SimpleMessage using a String containing the p/h ADT message. Configuration of the service tells the R.I. that this messages requires base64 encoding so the RI performs the encoding and builds the DistributionEnvelope with the appropriate tagging.

Receiver View

The Receiver consumers the SOAP message. This validates the SOAP headers and then extracts the payload. The SOAP payload is then split further into Distribution Envelope and business payload. The Distribution Envelope is validated and extracted into MessageProperties. The R.I. then looks up the service properties from the configuration and - in this case - as the payload is in base64 form it is decoded before being packaged up as a SimpleMessage and passed onto the Application Message Handler.

Request Message (Get example)

<soap:Envelope xmlns:itk="urn:nhs-itk:ns:201005" ... >
 <soap:Header> ... </soap:Header>
 <soap:Body>
  <itk:DistributionEnvelope ... >
   <itk:header service="urn:nhs-itk:services:201005:admitPatientPH-v1-0" ...>
    ...
   </itk:header>
   <itk:payloads count="1">
    <itk:payload id="...">TVNIfF5+X ... 4MTIzNHwNCg== </itk:payload>
   </itk:payloads>
  </itk:DistributionEnvelope>
 </soap:Body>
</soap:Envelope>

Simple Message Response (Get example)

<itk:manifest count="1">
        <itk:manifestitem base64="true"
            id="uuid_6e9306ba-9a09-4479-a719-fcc23234b9ec"
            mimetype="text/plain" profileid="ITKv1.0"/>
    </itk:manifest>
    <itk:senderAddress uri="urn:nhs-uk:addressing:ods:TESTORGS:ORGA"/>
</itk:header>
<itk:payloads count="1">
   <itk:payload id="uuid_6e9306ba-9a09-4479-a719-fcc23234b9ec">TVNIfF5+XCZ8...
    ....HwNCg==</itk:payload>
</itk:payloads>

How it all happens....

Step 1

The sending application code doesn't need to know that the message in in pipe and hat format - it just builds a message, sets the serviceId and sends it, as in the previous synchronous examples.

The full source code for the ADT Servlet can be seen here.

// Create the message
ITKMessage msg = new SimpleMessage();
msg.setBusinessPayload(phMessage);
...
mp.setServiceId("urn:nhs-itk:services:201005:admitPatientPH-v1-0");
...
// Send this message synchronously.
ITKMessage responseMsg = sender.sendSync(msg);

Step 2

A raw HL7v2 message in p/h format would not be valid data if just wrapped up in XML, so the ITK R.I. needs to know that this message is p/h so that it can construct the on-the-wire message accordingly. The R.I. uses a service.properties file to contain service configurations such as this.


urn\:nhs-itk\:services\:201005\:admitPatientPH-v1-0.isBase64=Y
urn\:nhs-itk\:services\:201005\:admitPatientPH-v1-0.mimeType=text/plain
			

Step 3

The Reference Implementation uses the service configuration to encode the message using core java language conversions.

if(service.isBase64()){
	String b64DocText = javax.xml.bind.DatatypeConverter.
  		printBase64Binary(request.getBusinessPayload().getBytes());
	request.setBusinessPayload(b64DocText);
}
message = new DEWrappedMessage(service, request, true);
			

Step 4

Now the R.I. sets the mime type, base64 encoding to the appropriate values and embeds the encoded message as the payload.

	<itk:manifest count="1">
		<itk:manifestitem base64="true"
			id="uuid_6e9306ba-9a09-4479-a719-fcc23234b9ec"
			mimetype="text/plain" profileid="ITKv1.0"/>
	</itk:manifest>
	<itk:senderAddress uri="urn:nhs-uk:addressing:ods:TESTORGS:ORGA"/>
</itk:header>
<itk:payloads count="1">
   <itk:payload id="uuid_6e9306ba-9a09-4479-a719-fcc23234b9ec">TVNIfF5+XCZ8...
	....HwNCg==</itk:payload>
</itk:payloads>