procedure Texport_plan.cxB_LoadClick(Sender: TObject);
var
  HTTP: TIdHTTP;
  Query: String;
  Buffer: TMemoryStream;
  loadData: Sting;
  responseData: String; 
begin 
  try
    HTTP := TIdHTTP.Create(nil);
    HTTP.Request.ContentEncoding := 'utf-8';
    HTTP.Request.ContentType := 'text/xml';
    Application.ProcessMessages;
    Query := 'http://priem.edu.ru:8000/import/ImportService.svc/import';
    loadData := '<Root></Root>'
    Buffer := TMemoryStream.Create;
    loadData.SaveToStream(Buffer);
    responseData := HTTP.Post(Query, Buffer);
  except
    on E: EIdHTTPProtocolException do
      ShowMessage(E.Message);
  end;
end;
这将返回 HTTP/1.1 400 错误请求。如果使用从http://priem.edu.ru:8000/import/ImportService.svc/test/import获取, 我会得到正确的 xml 文档作为响应。为什么会发生这种情况?我检查了所有我可以在谷歌找到的......但没有任何帮助。
我正在使用 RAD Delphi XE3
UPD:测试客户端工作正常...C# + webclient 类。delphi 可能还有更多的东西......不仅仅是IdHTTP?