Why does not respond the site after I sent a message?
------------------------code--------------------------------
unit Unit15;
{$include rtcDeploy.inc}
{$include rtcDefs.inc}
{$DEFINE StreamSecII}
{$DEFINE RTC_DEBUG}
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, rtcConn, rtcDataCli, rtcHttpCli, rtcSystem, rtcInfo, Vcl.StdCtrls,
RtcSSecTest, rtcDataSrv, rtcHttpSrv;
type
TForm15 = class(TForm)
RtcDataRequest1: TRtcDataRequest;
RtcHttpClient1: TRtcHttpClient;
Memo1: TMemo;
Button1: TButton;
procedure RtcDataRequest1DataReceived(Sender: TRtcConnection);
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure RtcHttpClient1ResponseReject(Sender: TRtcConnection);
private
{ Private declarations }
RecvContent: rtcString;
XML_string: rtcString;
public
{ Public declarations }
end;
var
Form15: TForm15;
implementation
{$R *.dfm}
procedure TForm15.Button1Click(Sender: TObject);
begin
RtcDataRequest1.Request.Clear;
XML_string := 'testen';
RtcHttpClient1.ServerAddr := '
https://webhook.site/f8afd984-2151-4332-84f7-ceab0d6480fd'; RtcHttpClient1.ServerPort := '443';
RtcDataRequest1.Request.FileName := '/test/';
RtcDataRequest1.Request.Host := RtcHttpClient1.ServerAddr;
RtcDataRequest1.Write(XML_string);
RtcDataRequest1.Request.ContentLength := Length(XML_string);
try
// Post the request with 'POST' :
RtcDataRequest1.PostMethod('POST');
RtcDataRequest1.WaitForCompletion;
except
on E: Exception do
Memo1.Lines.Add('Error with getting information by MSP : ' + E.Message)
end;
end;
procedure TForm15.FormCreate(Sender: TObject);
begin
// if the Server is using an expired certificate: }
AllowExpiredCertificates(true);
// If we do not have a root certificate on the client,
// we will use a HACK to allow the client to work with ANY Server: }
BeGullableAndTrustAnythingSentToYou(true);
{ This is a simple DEMO, so we will accept our "locahost" certificate,
even if our test Server is running on a remote PC and not locally: }
AddCertificateNameMap('*', 'localhost');
AddClientRootCertFile('C:\DigiCertGlobalRootCA.cer');
AddClientPFXFile('C:\client.pfx', 'abc');
RtcHttpClient1.CryptPlugin := GetClientCryptPlugin;
end;
procedure TForm15.RtcDataRequest1DataReceived(Sender: TRtcConnection);
begin
with TRtcDataClient(Sender) do
begin
if Response.Started then
if Response.Done then
RecvContent := Sender.Read;
Memo1.Lines.Add('Response: ' + RecvContent);
Memo1.Lines.Add('Status code: ' + IntToStr(Response.StatusCode));
Memo1.Lines.Add('Status text:' + Response.StatusText);
Memo1.Lines.Add('ALL Headers:');
Memo1.Lines.Add(Response.HeaderText);
Memo1.Lines.Add('Content Length:');
Memo1.Lines.Add(IntToStr(Response.ContentLength));
Memo1.Lines.Add('Content body:');
Memo1.Lines.Add('START >');
end; { Could be executed more than once, depending on the content size }
end;
procedure TForm15.RtcHttpClient1ResponseReject(Sender: TRtcConnection);
begin
showmessage('error in response');
end;
end.