Sun Adapter for TCP/IP HL7 Tutorial

Retrieving the Validation Results

The makeNAK() method retrieves the XML document generated from the schematron validation. The XML document is embedded in the AcknowledgementDetail section of HL7V3 Acknowledgement XML. The following excerpt defines the makeNAK() method.

makeNAK() method


if (schematronValidationError) {
   log( LOG_LEVEL_INFO, "Schematron validationOutputList.size=" 
     + validationOutputList.size());
   for (int i = 0; i < validationOutputList.size(); i++) {
      com.stc.connector.hl7.schematron.ValidationOutput output =
        (com.stc.connector.hl7.schematron.ValidationOutput) 
      validationOutputList.get( i );
      String outputStr = output.getOutputAsString();

      otd_MCCI_IN000004UV01_1.getAcknowledgement( 0 ).
        getAcknowledgementDetail( i ).getTypeCode().setCode( "E" );
      otd_MCCI_IN000004UV01_1.getAcknowledgement( 0 ).
        getAcknowledgementDetail( i ).getCode().setCode
        ( "Validation Failure: Schematron Validation Failed" );
      otd_MCCI_IN000004UV01_1.getAcknowledgement( 0 ).
        getAcknowledgementDetail( i ).getText().setMediaType( "text/xml" );
      otd_MCCI_IN000004UV01_1.getAcknowledgement( 0 ).
        getAcknowledgementDetail( i ).getText().setX__PCDATA__MX( outputStr );
      log( LOG_LEVEL_INFO, "Schematron Validation Output = " + outputStr );
   }
}

The above text has been wrapped for display purposes. The image below shows the code as it appears in the Collaboration Editor.

Properties of makeNAK