简体   繁体   中英

HTTPRIO connecting to webservice “error : HTTP/1.1 401 Unauthorized” on OS, while working in Win32

I have a simple project that uses the checkVatService.wsdl to chek the vality of european VAT numbers.

When running the project on MACOS I the following error : " error : HTTP/1.1 401 Unauthorized ".

When running on Win32 the project returns "valid"

procedure TForm1.ControleVat;
var
  cv  : checkVatApprox;
  cvs : checkVatApproxResponse;
  HTTPRIO1: THTTPRIO;
begin

  HTTPRIO1 := THTTPRIO.Create(nil);

  HTTPRIO1.WSDLLocation := 'checkVatservice.WSDL';
  HTTPRIO1.Service := 'checkVatService';
  HTTPRIO1.Port := 'checkVatPort';

  cvs:=nil;
  cv:=checkVatApprox.Create;
  try
    cv.countryCode := 'BE';
    cv.vatNumber   := '0000000097'; 
    try
      cvs:= ( HTTPRIO1 as checkVatPortType ).checkVatApprox(cv);
      if cvs.valid then begin
        showmessage('valid');
      end else begin
        showmessage('invalid');
      end;
    except
      on e:exception do begin
        showmessage('error : ' + e.Message);
      end;
    end;

  finally
    cv.Free;
    freeandnil(cvs);
  end;
end;

The service does not require autohorisation and both in Win32 and OS the username/password are blank.

What is causing this error? What is the difference in connection?

i have same problem, in android. in windows it's all ok; it seems related to some strange server issue, if client retrive ipv6 instead ipv4..

i suggest you to use : https://www.isvat.eu/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM