First, I indeed posted my reply in the wrong place.
I was looking there for you answer for my xml questions, but that program you advised me to work with a rtcFunction and that program works fine.
However now I must use xml and I am struggling again.
I apricate very much that you help so good.
===========================
I altered the code as you suggested and made also the last additions.
I post here the last bit.
Only I get an error on:
RtcDataRequest1.PostMethod('POST', XML_string);
// <--- GIVES A COMPILE ERROR 'THERE IS NO OVERLOADED VERSION OF THIS'
Also can you point me to a good example to implement StreamSec2 for the RtcDataRequest for that must be in HTTPS.
Thanks
Henk
====================
procedure TWork.RtcDataProvider1DataReceived(Sender: TRtcConnection);
var
RecvContent, ResultText, StatusText: rtcString;
begin
with Sender as TRtcDataServer do
begin
if Request.Complete then
begin
RecvContent := Sender.Read;
TransactionID_str := Request.Query['transactionid'];
if DoDebug then
Memo1.Text := Memo1.Text + READ;
Memo1.Lines.Add('ID=' + TransactionID_str);
try
IDealRecNr := StrToInt(TransactionID_str);
except
on E: Exception do
if DoDebug then
Memo1.Lines.Add('Fout bij vertalen recordnummer van parameter : ' + E.Message);
end;
with RtcDataRequest1 do
begin
Request.FileName := '/' + TransactionID_str;
CoInitialize(nil);
// nu in database Huurovereenkomst controleren - indien OK dan VerstuurHTML:
// maak XML-file:
Exportfilenaam := 'IDeal_' + IntToStr(IDealRecNr) + '.XML';
XMLDoc1.Active := false;
XMLDoc1.Xml.Text := '';
XMLDoc1.Active := true;
XMLDoc1.Encoding := 'UTF-8';
XMLDoc1.AddChild('Pricat', '
http://www.ean.nl');
XMLDoc1.DocumentElement := XMLDoc1.CreateNode('status');
XMLDoc1.DocumentElement.Attributes['ua'] := 'RTC Library)';
// merchant
iNode_Merchant := XMLDoc1.DocumentElement.AddChild('merchant');
iChild := iNode_Merchant.AddChild('account');
iChild.Text := DM1.nxT_algpar.FieldByName('IDeal_account').AsString;
iChild := iNode_Merchant.AddChild('site_id');
iChild.Text := DM1.nxT_algpar.FieldByName('IDeal_site_id').AsString;
iChild := iNode_Merchant.AddChild('site_secure_code');
iChild.Text := DM1.nxT_algpar.FieldByName('IDeal_site_secure_id').AsString;
// transaction
iNodeTransaction := XMLDoc1.DocumentElement.AddChild('transaction');
iChild := iNodeTransaction.AddChild('id');
iChild.Text := IntToStr(IDealRecNr);
// bestand maken:
if DoDebug then
XMLDoc1.SaveToFile(DM1.XML_Dir + Exportfilenaam);
XMLDoc1.SaveToXML(XML_string);
// now get the information
RtcHttpClient1.ServerAddr := DM1.SiteURL;
RtcHttpClient1.ServerPort := IntToStr(DM1.SitePort);
// Post the request with 'POST' :
RtcDataRequest1.PostMethod('POST', XML_string); // <--- GIVES A COMPILE ERROR 'THERE IS NO OVERLOADED VERSION OF THIS'
WaitForCompletion;
XMLDoc1.Active := false;
XMLDoc2.Active := false;
XMLDoc2.LoadFromXML(RecvContent); // Response is an XML file
XMLDoc2.Active := true;
// now get the information from XMLdoc2:
ResultText := XMLDoc2.DocumentElement.Attributes['result'];
iNodeEwallet := XMLDoc2.DocumentElement.ChildNodes.FindNode('ewallet');
iNodeStatus := iNodeEwallet.ChildNodes.FindNode('status');
if Assigned(iNodeStatus) then
StatusText := iNodeStatus.Text;
// database bijwerken:
if DM1.nxT_IDealRecords.FindKey([IDealRecNr]) then
begin
if Uppercase(ResultText) = 'OK' then
begin
DM1.nxT_IDealRecords.Edit;
DM1.nxT_IDealRecords.FieldByName('StatusOntvangen').AsBoolean := true;
DM1.nxT_IDealRecords.FieldByName('Status').AsString := StatusText;
if Uppercase(StatusText) = 'COMPLETED' then
DM1.nxT_IDealRecords.FieldByName('BetalingOK').AsBoolean := true;
DM1.nxT_IDealRecords.Post;
end
else
begin
DM1.nxT_IDealRecords.Edit;
DM1.nxT_IDealRecords.FieldByName('StatusOntvangen').AsBoolean := false;
DM1.nxT_IDealRecords.FieldByName('Status').AsString := StatusText;
DM1.nxT_IDealRecords.FieldByName('Foutkode').AsString := ResultText;
DM1.nxT_IDealRecords.Post;
end;
end
else if DoDebug then
Memo1.Lines.Add('Kan IDealrecord niet vinden');
// bewaren als laatste zodat eerst de database wordt bijgewerkt
if DoDebug then
XMLDoc2.SaveToFile(DM1.XML_Dir + DateTimeToStr(now) + 'result' + IntToStr(IDealRecNr) + '.xml');
CoUninitialize;
end;
end;
end;
end;