El servicio web de consumo con autenticación siempre da el mensaje Se requiere autenticación
Intento utilizar Consumo de un servicio web con Delphi 2010. Este servicio web está en el puerto 8000 con autenticación.
Implemento el
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;
pero todavía tengo el mensaje "Se requiere autenticación".
¿Hago algo mal?