web services - Disable certificate validation -


i need consume wcf, has certificate , need disable authentication. know how can in delphi xe2?

i've tried codes below:

first attempt :

rio.httpwebnode.invokeoptions:= [soignoreinvalidcerts,soautocheckaccesspointviauddi];

where rio thttprio.

second attempt:

    class procedure classeteste.onbeforepost(const httpreqresp: thttpreqresp;       data: pointer);     var       securityflags: dword;       securityflagslen: dword;       request: hinternet;       begin       request := data;       if soignoreinvalidcerts in rio.httpwebnode.invokeoptions       begin         securityflagslen := sizeof(securityflags);         internetqueryoption(request, internet_option_security_flags,         pointer(@securityflags), securityflagslen);         securityflags := securityflags or internet_flag_ignore_cert_cn_invalid;         internetsetoption(request, internet_option_security_flags,         pointer(@securityflags), securityflagslen);       end;     end;  rio.httpwebnode.onbeforepost:= classeteste.onbeforepost; 

i can using c#, code below:

channel = new channelfactory<wsmain.iwsinterface>("****");                 channel.credentials.username.username = "*****";                 channel.credentials.username.password = "*****";                 channel.credentials.servicecertificate.authentication.certificatevalidationmode = system.servicemodel.security.x509certificatevalidationmode.none; 

add following lines after request:

  securityflags := securityflags or security_flag_ignore_revocation;   internetsetoption(request, internet_option_security_flags, pointer(@securityflags), securityflagslen); 

which done:

procedure tform1.rio_onbeforepost(const httpreqresp: thttpreqresp; data: pointer);   var    securityflags: dword;    securityflagslen: dword;    request: hinternet;  begin   request := data;    securityflagslen := sizeof(securityflags);   internetqueryoption(request, internet_option_security_flags, pointer(@securityflags), securityflagslen);    securityflags := securityflags or security_flag_ignore_unknown_ca;   internetsetoption(request, internet_option_security_flags, pointer(@securityflags), securityflagslen);    // solved problem   securityflags := securityflags or security_flag_ignore_revocation;   internetsetoption(request, internet_option_security_flags, pointer(@securityflags), securityflagslen);   end; 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -