...
uses ... Rio, SOAPHTTPClient, WinInet , SOAPHttpTrans, EncdDecd, ...
...
procedure TForm2.rioHTTPWebNode1BeforePost(const HTTPReqResp: THTTPReqResp; //Fügt den benötigten HTTP-Header hinzu für die Basic-Authentication
Data: Pointer);
var
S: String;
begin
S := 'Authorization: Basic **************=='; //HTTP-Basic-Authorization-Header
HttpAddRequestHeaders(Data, PChar(S), Length(S), HTTP_ADDREQ_FLAG_ADD);
end;
procedure TForm2.Button1Click(Sender: TObject);
var request, response: TStringStream;
strings: TStringList;
str: string;
recieveID: integer;
begin
rio.HTTPWebNode.URL := 'https://********************/webservice/***************Service'; //
URL des Webservices
rio.HTTPWebNode.SoapAction := 'http://**************/abrufen*************************'; //
URL der aufzurufenden Methode
rio.HTTPWebNode.Agent := 'Mozilla';
rio.Port := '443';
try
strings := TStringList.Create;
strings.LoadFromFile('request.xml'); //Hier ist der
XML-request enthalten
request := TStringStream.Create(strings.GetText);
response := TStringStream.Create('');
recieveID := rio.HTTPWebNode.Send(request); //Request
rio.HTTPWebNode.Receive(recieveID,response,false); //Response
response.Position := 0;
mmo2.Lines.LoadFromStream(response, TEncoding.UTF8);
finally
strings.Free;
request.Free;
response.Free;
end;
end;