Invalid message , must be start with MSH

Discussion of open issues, suggestions and bugs regarding to (known as Delphi HL7) HL7 Components
Post Reply
ppb
Posts: 9
Joined: Sat Sep 08, 2012 11:09 am

Invalid message , must be start with MSH

Post by ppb »

Hello everybody,

I have this function and it does not work
always return "Invalid message , must be start with MSH"

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
var
    msg : TdiORU_R01_25;
begin
    msg:=TdiORU_R01_25.Create;
    msg.LoadFromFile('oru_r01_24.xml');
    Memo1.Lines.Text:=msg.AsString;
    msg.Free;
end;
if i change this line like that , one access violation is raised in diXml.pas

Code: Select all

msg.LoadFromFile('oru_r01_24.xml',ftXML);
thanks and best regards.
enviroment : DelphiXE7 and Standar Edition DelphiHL7v27Std1.6.13

the "oru_r01_24.xml" file conten :

Code: Select all

<ORU_R01 xmlns="urn:hl7-org:v2xml">
	<MSH>
		<MSH.1>|</MSH.1>
		<MSH.2>^~\&amp;</MSH.2>
		<MSH.3>
			<HD.1>GHH LAB</HD.1>
		</MSH.3>
		<MSH.4>
			<HD.1>ELAB-3</HD.1>
		</MSH.4>
		<MSH.5>
			<HD.1>GHH OE</HD.1>
		</MSH.5>
		<MSH.6>
			<HD.1>BLDG4</HD.1>
		</MSH.6>
		<MSH.7>
			<TS.1>20171101220908</TS.1>
		</MSH.7>
		<MSH.9>
			<MSG.1>ORU</MSG.1>
			<MSG.2>R01</MSG.2>
		</MSH.9>
		<MSH.10>CNTRL-3456</MSH.10>
		<MSH.11>
			<PT.1>P</PT.1>
		</MSH.11>
		<MSH.12>
			<VID.1>2.5</VID.1>
		</MSH.12>
	</MSH>
	<ORU_R01.PATIENT_RESULT>
		<ORU_R01.PATIENT>
			<PID>
				<PID.5>
					<XPN.1>
						<FN.1>EVERYWOMAN</FN.1>
					</XPN.1>
					<XPN.2>EVE</XPN.2>
					<XPN.3>E</XPN.3>
					<XPN.7>L</XPN.7>
				</PID.5>
				<PID.6>
					<XPN.1>
						<FN.1>JONES</FN.1>
					</XPN.1>
				</PID.6>
				<PID.8>F</PID.8>
				<PID.11>
					<XAD.1>
						<SAD.1>153 FERNWOOD DR.</SAD.1>
					</XAD.1>
					<XAD.3>STATESVILLE</XAD.3>
					<XAD.4>OH</XAD.4>
					<XAD.5>35292</XAD.5>
				</PID.11>
				<PID.13>
					<XTN.1>(206)3345232</XTN.1>
				</PID.13>
				<PID.14>
					<XTN.1>(206)752-121</XTN.1>
				</PID.14>
				<PID.20>
					<DLN.2>OH</DLN.2>
					<DLN.3>20030520</DLN.3>
				</PID.20>
			</PID>
		</ORU_R01.PATIENT>
		<ORU_R01.ORDER_OBSERVATION>
			<OBR>
				<OBR.1>1</OBR.1>
				<OBR.2>
					<EI.1>845439</EI.1>
					<EI.2>GHH OE</EI.2>
				</OBR.2>
				<OBR.3>
					<EI.1>1045813</EI.1>
					<EI.2>GHH LAB</EI.2>
				</OBR.3>
				<OBR.4>
					<CE.1>1554-5</CE.1>
					<CE.2>GLUCOSE</CE.2>
					<CE.3>LN</CE.3>
				</OBR.4>
				<OBR.16>
					<XCN.1>555-55-5555</XCN.1>
					<XCN.2>
						<FN.1>PRIMARY</FN.1>
					</XCN.2>
					<XCN.3>PATRICIA P</XCN.3>
					<XCN.7>MD</XCN.7>
					<XCN.9>
						<HD.1>LEVEL SEVEN HEALTHCARE, INC.</HD.1>
					</XCN.9>
				</OBR.16>
				<OBR.25>F</OBR.25>
			</OBR>
			<ORU_R01.OBSERVATION>
				<OBX>
					<OBX.1>1</OBX.1>
					<OBX.2>SN</OBX.2>
					<OBX.3>
						<CE.1>1554-5</CE.1>
						<CE.2>GLUCOSE POST 12H CFST</CE.2>
						<CE.3>LN</CE.3>
					</OBX.3>
					<OBX.5>
						<SN.2>182</SN.2>
					</OBX.5>
					<OBX.6>
						<CE.1>mg/dl</CE.1>
					</OBX.6>
					<OBX.7>70-105</OBX.7>
					<OBX.11>F</OBX.11>
				</OBX>
			</ORU_R01.OBSERVATION>
		</ORU_R01.ORDER_OBSERVATION>
	</ORU_R01.PATIENT_RESULT>
</ORU_R01>
admin
Site Admin
Posts: 256
Joined: Sun Jun 05, 2011 8:06 pm

Re: Invalid message , must be start with MSH

Post by admin »

Hi,

Standart edition not support XML import/export.

Best regards.
ppb
Posts: 9
Joined: Sat Sep 08, 2012 11:09 am

Re: Invalid message , must be start with MSH

Post by ppb »

Hello,
We have purcahed BesaHL7v25ProDXE7_1.7.3
and we have the same error.

We have installed BSHL7CoreDXE7.dpk and BSHL725DXE7.dpk

Code: Select all

procedure TForm13.Button1Click(Sender: TObject);
var
  msgOUL_R24: TbsOUL_R24_25;
  StringList : TStringList;
  s : WideString;
begin
  // --- Leer fichero XML
  StringList:=TStringList.Create;
  msgOUL_R24:=TbsOUL_R24_25.Create;
  try
    StringList.LoadFromFile('Ejemplo4.xml', TEncoding.UTF8);
    s:=StringList.Text;
    //msgOUL_R24.AsXML:=s;
    msgOUL_R24.LoadFromFile('Ejemplo4.xml');

    WriteTextToFile( 'kakita.xml', msgOUL_R24.AsString );
  finally
    msgOUL_R24.Free;
    StringList.Free;
  end;
end;


procedure TForm13.FormCreate(Sender: TObject);
begin
  BSHL7Library.LoadFromFile('BSHL725.BSL');
end;
admin
Site Admin
Posts: 256
Joined: Sun Jun 05, 2011 8:06 pm

Re: Invalid message , must be start with MSH

Post by admin »

Hi,

Please send sample project.

Best regards.
ppb
Posts: 9
Joined: Sat Sep 08, 2012 11:09 am

Re: Invalid message , must be start with MSH

Post by ppb »

there it goes.

Thanks.
Attachments
HL7-XML.7z
(87.64 KiB) Downloaded 1721 times
admin
Site Admin
Posts: 256
Joined: Sun Jun 05, 2011 8:06 pm

Re: Invalid message , must be start with MSH

Post by admin »

Hi,

LoadFromFile method only supports standard HL7 format.

For XML format, you must use AsXML property.

Best Regards.
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests