サーバーアプリで何も正しく受信できません。
プロパティRequest.Accept = text/html, */*を使用して、設計時の TIdHTTP コンポーネントを使用する送信者コード
procedure TFrmTTWebserviceTester.Button1Click(Sender: TObject);
var
lJSO : ISuperObject;
lRequest: TStringStream;
lResponse: String;
begin
lJSO := SO('{"name": "Henri Gourvest", "vip": true, "telephones": ["000000000", "111111111111"], "age": 33, "size": 1.83, "adresses": [ { "adress": "blabla", "city": "Metz", "pc": 57000 }, { "adress": "blabla", "city": "Nantes", "pc": 44000 } ]}');
lRequest := TStringStream.Create(lJSO.AsString,TEncoding.UTF8); // or ASCII
// showmessage(lRequest.DataString); Correct data
IdHTTP.Request.ContentType := 'application/json';
// idHTTP.Request.Charset := 'utf-8';
lResponse := IdHTTP.Post('http://localhost:8085/ttposttest',lRequest);
// ShowMessage(lResponse.dataString);
lRequest.Free;
lJSO := nil;
end;
Receiver は TWebModule の TWebAction であり、MethodType mtPost (または mtAny) にハンドラーを設定します。
procedure TWebModuleWebServices.WebModuleWebServicesTTPostTestAction(
Sender: TObject; Request: TWebRequest; Response: TWebResponse;
var Handled: Boolean);
var S: String;
begin
S := Request.Query;
Handled := true;
end; { WebModuleWebServicesTTPostTestAction }
Request.Query が空です。
すべての VCL アプリ。私はこれらの SO の投稿や他の多くの投稿を読みましたが、何かを見落としているに違いありません...
ティア、ヤン