-3

Get send request to the server and receives an error 409, the program is suspended, using try except and ignore her, I had also an error 409 and XML response, how do I read it?

HTTP.Response.gettext - not give it to me, only the information about the server

http.response.rawheaders.commatext - only the information about the server

content lenght matches

The answer can be seen in the sniffer

I get an answer in the program?

  • Get what answer ? The response content ? How are you getting the content in code ? Have you even tried the code from my (now deleted) post ? – TLama Oct 18 '12 at 08:22
  • HTTP/1.1 409 Conflict Content-Type: text/xml; charset=utf-8 Server: Jetty(6.1.x) Content-Length: 160 Connection: keep-alive – user1748535 Oct 18 '12 at 08:23
  • This is in response to the sniffer through http.get I only get HTTP/1.1 409 Conflict Content-Type: text/xml; charset=utf-8 Server: Jetty(6.1.x) Content-Length: 160 Connection: keep-alive – user1748535 Oct 18 '12 at 08:25
  • 1
    You can't get it maybe because `failure cause="INVALID_PASSWORD"` ? Anyway, please try avoid to write so many comments; rather include all needed information to the question. Thanks! – TLama Oct 18 '12 at 08:48
  • 1
    I realise that English is not your first language, and that you are new here. But this is a poor question. It's hard to understand what your problem is. You are adding more detail in the comments, rather than in the question. This is a wiki. You can edit the question with more details. I suggest you delete your comments and transfer them to the question. You need to take more time to clarify the question. If you do that you will get good help. – David Heffernan Oct 18 '12 at 09:02

1 Answers1

2

When TIdHTTP receives an HTTP error from the server, like 409, it raises an EIdHTTPProtocolException exception, and the content text of the error will be in its ErrorMessage property, eg:

try
  IdHTTP1.Get(...);
except
  on E: EIdHTTPProtocolException do
  begin
    // HTTP-specific error
    ShowMessage(Format('HTTP Error'#13'Response: %d %s'#13'Content: %s', [E.ErrorCode, E.Message, E.ErrorMessage]));
  end;
  on E: Exception do
  begin
    // any other error
    ShowMessage(Format('Exception'#13'Class: %s'#13'%s', [E.ClassName, E.Message]));
  end;
end;

When you encounter the password error, it should show a popup message box saying the following:

HTTP Error
Response: 409 Conflict
Content: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><error code="10003" appid="1"><failure cause="INVALID_PASSWORD" field="password" value="******"/></error>
Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770