Delphi 通过与Indy的安全连接将文件发送到网站

Delphi 通过与Indy的安全连接将文件发送到网站,delphi,indy10,Delphi,Indy10,我必须发送一个XML文件到一个安全连接的网站。德尔福2010,印第10.5.9页。使用的代码如下: Params: TIdMultiPartFormDataStream; ResponseStr: string; begin result := 0; sRootCertFile := 'xxx\Digital.pem'; sCertFile := 'xxx\Digital.pem'; sKeyFile := 'xxx\Digital.pem'; with FAdmin

我必须发送一个XML文件到一个安全连接的网站。德尔福2010,印第10.5.9页。使用的代码如下:

  Params: TIdMultiPartFormDataStream;
  ResponseStr: string;
begin
  result := 0;
  sRootCertFile := 'xxx\Digital.pem';
  sCertFile := 'xxx\Digital.pem';
  sKeyFile := 'xxx\Digital.pem';
  with FAdminSetup.RDWSSLHandler do
  begin
    SSLOptions.VerifyMode := [];
    SSLOptions.VerifyDepth := 0;
    SSLOptions.RootCertFile := sRootCertFile;
    SSLOptions.CertFile := sCertFile;
    SSLOptions.KeyFile := sKeyFile;
  end;
  sURL := 'https://xxx/xxxservice';
  begin
    IdHttpVVO := TIdHttp.Create(nil);
    try
//      IdHttpVVO.Request.ContentType := 'multipart/form-data';    
//      IdHttpVVO.ProtocolVersion := pv1_1;
//      IdHttpVVO.HTTPOptions := [hoKeepOrigProtocol,hoForceEncodeParams];
//      IdHttpVVO.Request.Connection    := 'Keep-Alive';
//      IdHttpVVO.Request.CacheControl := 'no-cache';
//      IdHttpVVO.Request.ContentLength := Length(sAnsiXML); // <-- new
      IdHttpVVO.IOHandler := FAdminSetup.RDWSSLHandler;
      Params := TIdMultiPartFormDataStream.Create;
      try
        with Params do
        begin
          AddFile('file', filename, GetMIMETypeFromFile(filename));
        end;
        resultStr := IdHttpVVO.Post(sURL, Params);
      finally
        Params.Free;
      end;
      ShowMessage(resultstr);
procedure TFAdminSetup.RDWSSLHandlerGetPasswordEx(ASender: TObject;
  var VPassword: AnsiString; const AIsWrite: Boolean);
begin
  VPassword := 'xxx';
end;
该网站正在运行,证书似乎还可以,因为其中包含一个用C编写的小工具

我的错在哪里?谢谢