Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

About TIdHTTP...

Status
Not open for further replies.

IPOz

Programmer
Jul 11, 2001
109
CN
Hi friends,
Now i am using TIdHTTP to call a servlet which will accept and return XML data. The TIdHTTP works very well but i have question about it.

.the get methods
procedure Get(AURL: string; const AResponseContent: TStream); overload;
function Get(AURL: string): string; overload;

Parameters
AURL: string
The resource to be retrieved.

const AResponseContent: TStream
Destination for the data retrieved.

the get(AURL:string) works very well and i can get the XML data from the servlet.However if i use get(AURL:string; const AResponseContent:TStream) as below,i donot understand how to use the second parameter.
....
var
ms : TMemoryStream;
begin
ms := TMemoryStream.create;
try IdHTTP1.get(' memo1.Lines.loadFromStream(ms); <= get nothing
finally
ms.free;
end;
end;

the memo1 will not have any data :(. However the following code works very well:
...
try
memo1.Text := IdHTTP1.get('except
raise;
end

.the put methods
procedure Post(URL: string; const Source: TStrings; const AResponseContent: TStream); overload;

Parameters
URL: string
Location of the host or CGI application.

const Source: TStrings
Object containing the request data.

const AResponseContent: TStream
Destination for response data.

I still cannot understand how to use AResponseContent parameter to get the return data.
...
var
ms : TMemoryStream;
begin
ms := TMemoryStream.create;
try
IdHTTP1.put(' memo2.lines.loadFromStream(ms); <= get nothing
finally
free;
end;
end;

Any suggestion is appreciated ! ipo_z@cmmail.com
garbage in,garbage out
 
There has been no answer for a long time . Does nobody ever use TIdHTTP component ?


regards! ipo_z@cmmail.com
garbage in,garbage out
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top