J'essaie d'utiliser un service Web avec Delphi 2010. Ce service Web est sur le port 8000 avec authentification.consommer un service Web avec l'authentification donne toujours un message Authentification requise
je mettre en œuvre le
function TForm4.EncodeLoginPW(const ALogin, APW: string): string;
begin
Result := EncdDecd.EncodeString(ALogin + ':' + APW); // EncdDecd is not documented in
end;
procedure TForm4.HTTPRIO1HTTPWebNode1BeforePost(const HTTPReqResp: THTTPReqResp;
Data: Pointer);
var
s: string;
begin
s := 'Authorization: Basic ' + EncodeLoginPW(UserName, Password);
if not HttpAddRequestHeaders(Data, PChar(s), Length(s), HTTP_ADDREQ_FLAG_ADD) then
ShowMessage('HttpAddRequestHeaders' + SysErrorMessage(GetLastError()));
end;
mais je dois encore le message "Authentification requise".
Est-ce que je fais quelque chose de mal?
De quel type d'authentification s'agit-il? Pouvez-vous exécuter avec succès une requête d'un navigateur Web avec l'URL et le port donnés? – mjn
Le type d'anthentication est basique. –
Pouvez-vous exécuter une requête «manuelle» d'un navigateur Web vers l'URL du service? (le navigateur demandera habituellement l'authentification) – mjn