unit GetUID;
interface
uses
Winapi.Windows,
Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
Vcl.StdCtrls, System.Net.HttpClient, System.Net.URLClient,
System.Net.HttpClientComponent,
Xml.xmldom,
Xml.XMLDoc,
Xml.XMLIntf,
UID;
type
TForm3 =
class(TForm)
btnSampleCall1: TButton;
btnSampleCall2: TButton;
NetHTTPClient1: TNetHTTPClient;
procedure btnSampleCall1Click(Sender: TObject);
procedure btnSampleCall2Click(Sender: TObject);
private
procedure ShowResponse(
const URL:
string);
end;
var
Form3: TForm3;
implementation
{$R *.dfm}
// https://evatr.bff-online.de/eVatR/xmlrpc/http
const
SAMPLE1 = '
https://evatr.bff-online.de/evatrRPC?UstId_1=DE123456789&UstId_2=AB1234567890&Firmenname=&Ort=&PLZ=&Strasse=';
SAMPLE2 = '
https://evatr.bff-online.de/evatrRPC?UstId_1=DE123456789&UstId_2=AB1234567890&Firmenname=Firmenname einschl. Rechtsform&Ort=Ort der Firma&PLZ=12345&Strasse=Strasse der Firma';
procedure TForm3.btnSampleCall1Click(Sender: TObject);
begin
ShowResponse(SAMPLE1);
end;
procedure TForm3.btnSampleCall2Click(Sender: TObject);
begin
ShowResponse(SAMPLE2);
end;
procedure TForm3.ShowResponse(
const URL:
string);
var
Response: IHTTPResponse;
XmlDoc: IXMLDocument;
RPCAnswer: UID.IXMLParamsType;
Param: UID.IXMLParamType;
Value, Value2: UID.IXMLValueType;
I, J, K: Integer;
DbgStr:
string;
begin
Response := NetHTTPClient1.Get(
URL);
XmlDoc := NewXMLDocument();
XmlDoc.LoadFromXML(Response.ContentAsString());
RPCAnswer := Getparams(XmlDoc);
DbgStr := '
';
for I := 0
to RPCAnswer.Count - 1
do
begin
Param := RPCAnswer.Param[I];
DbgStr := DbgStr + '
Param: ' + I.ToString + Param.Value.String_ + sLineBreak;
for J := 0
to Param.Value.Array_.Data.Count - 1
do
begin
Value := Param.Value.Array_.Data.Value[J];
if Value.String_ <> '
'
then
DbgStr := DbgStr + '
....Value ' + J.ToString + '
string: ' + Value.String_ + sLineBreak;
// weitere Schachtelungen möglich, hier aber nicht in den beiden Beispielen
for K := 0
to Value.Array_.Data.Count - 1
do
begin
Value2 := Value.Array_.Data.Value[K];
if Value2.String_ <> '
'
then
DbgStr := DbgStr + '
.......Value ' + K.ToString + '
string: ' + Value2.String_ + sLineBreak;
end;
end;
end;
ShowMessage(DbgStr);
end;
end.