consumir serviço da web com autenticação sempre fornece a mensagem Autenticação necessária
Eu tento usar consumir um serviço web com o Delphi 2010. Este serviço web está na porta 8000 com autenticação.
Eu implemento o
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;
mas ainda tenho a mensagem "Autenticação necessária".
Cometo algo errado?