delphi - JSON data posted with TIdHTTP.Post not received -
i can't server app receive anything.
sender code using design-time tidhttp component, property
request.accept = text/html, */*
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 twebaction on twebmodule, set methodtype mtpost (or mtany) handler:
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 empty.
vcl apps. have read these so posts , many others must overlooking something...
tia, jan
the twebrequest.query
property returns url query string, not sending any. why blank. post
data accessible twebrequest.content
, twebrequest.rawcontent
properties instead.
Comments
Post a Comment