|Subject:||Re: IdHTTPClient POST problem|
|Posted by:||Remy Lebeau \(Indy Team\) (re…@lebeausoftware.org)|
|Date:||Tue, 13 Apr 2010|
"Walters" <amit_walt…@yahoo.co.in> wrote in message
> there is no HOST and PORT in IdHTTPClient as it is in Indy 8
You are not supposed to be setting those properties manually to begin with.
Post() parses the input URL and updates the properties as needed.
> when I am trying to use POST Function programme become Non-responding no
> message send.
Well, for starters, you are not taking into account that everything in 2009
is now Unicode. You need to update your code according.
Second, you are using the wrong version of Post() to send XML data. The
TStrings version is going to encode the data in a way that will break the
XML. Use the TStream version instead.
> My code is like this it is working in (C++Builder 6 & Indy 8.0.25)
Try this code:
bool __fastcall TMainForm::SendXmlToServer(const String &tXmlData)
TIdHTTP *HTTPClient= new TIdHTTP(NULL);
HTTPClient->Request->Accept = "*/*";
HTTPClient->Request->AcceptLanguage = "en-us";
HTTPClient->Request->UserAgent ="Mozilla/4.0 (compatible; MSIE
6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)";
HTTPClient->Request->ContentType ="text/xml; charset=utf-8";
TMemoryStream *reqStream = new TMemoryStream();
TMemoryStream *resStream = new TMemoryStream();
reqStream->Position = 0;
resStream->Position = 0;
RetVal = true;
catch(const Exception &)
RetVal = false;
Remy Lebeau (Indy Team)
IdHTTPClient POST problem posted by Walters on Mon, 12 Apr 2010