Hi RTT, et al, for previous tips.
I assigned text to body but not reset position to start. I modified code
but still having same result.
I'm playing with OverbyteIcsHttpsTst sample and button "Post" with next
code:
void __fastcall THttpTestForm::PostButtonClick(TObject *Sender)
{
try {
PrepareConnection();
Display("Connecting...");
PostButton->Enabled = FALSE;
DocumentMemo->Clear();
SslHttpCli1->SendStream = new TStringStream();
// AnsiString asPost;
// asPost = PostMemo->Text;
// SslHttpCli1->SendStream->WriteBuffer(&asPost, asPost.Length());
// SslHttpCli1->SendStream->Seek(soFromBeginning, 0);
WideString ws;
ws = PostMemo->Text;
SslHttpCli1->SendStream->WriteBuffer(&ws, ws.Length());
SslHttpCli1->SendStream->Position = 0;
SslHttpCli1->PostASync();
} catch (Exception& E) {
Display("Connect error. " + E.ClassName() + ": " + E.Message);
return;
}
}
You can see I tried to assign body in two ways, using a AnsiString or a
WideString, but always I get the same result from https server : body is
empty.
The body I need to send is like next line:
{"email":"acco...@domain.com","tipo":"A"}
I take a look debug file but, sincerely, I don't understand de sequence
and I can't see there the text I want to send.
Surely is there something wrong but I can't figure were is.
I appreciate any tip about it.
Thanks in advance.
Xavi
El 10/08/2017 a les 22:32, RTT ha escrit:
I get error "Body is empty".
Is this a ICS error message?! I can't find such message in the ICS code.
AnsiString asPost;
asPost = PostMemo->Text;
SslHttpCli1->SendStream->WriteBuffer(&asPost, asPost.Length());
What kind of stream have you assigned to the SendStream property?
Don't forget to reset the SendStream position before the request. The
component sends from the stream position.
SslHttpCli1.SendStream.seek(0,soFromBeginning);
--
Xavier Mor-Mur
---
El software de antivirus Avast ha analizado este correo electrónico en busca de
virus.
https://www.avast.com/antivirus
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be