Post response code 500

Giganews Newsgroups
Subject: Post response code 500
Posted by:  Chris Schofield (Chris@nospam-c-j-s.co.uk)
Date: Thu, 1 Jun 2006

Hi

First of all.  I have looked through this newsgroup and others through
google.com and could not find an answer.

I am using indy 9 http component.

The server returns message 500 for my call but it also sends some xml data
that it would bbe useful if i could read it.

How do I get the xml data if the http.post has thrown an exception?

Here is my code

  fsres := TStringStream.Create('');

  httpstream := TStringStream.Create('');

    try
      IdHTTP1.Post(
        '/xxxxxxx/cgiprog',
        httpstream,
        fsres);
      // read down xml creating class list for each file

      fsres.Position := 0;
      outsl.LoadFromStream(fsres);

    except
      on e: Exception do begin
        if IdHTTP1.ResponseCode <> 200 then begin

        // ??????

        end;
    end;

Many thanks

Regards

Chris

Replies