http - Problem with Indy IdHttp Post in Delphi 2010 -


I have problems with the Indy IdHttp post method. The CallRpc () function compiled with Delphi 2007 works fine, but the code compiled with Delphi 2010 raises the same exception.

What should I consider when I change the Delphi 2007 indie TIDHTP to Delphi 2010 Indi TIDHTP?

  function callRpc (constantWorld, SXM: string): string; Var sandstream: tistream; IDHTP: TIDHTP; Start SendStream: = TMemoryStream.Create; IDHTP: TIDHTP. Cut (zero); IWP Try the request. Accept: = '* / *'; IdHttp.Request.ContentType: '' text / sXML '; IdHttp.Request.Connection: 'Keep-Elite'; IdHttp.Request.ContentLength: = Length (SXML); Stringstostream (SXML, sandstream); SendStream.Position: = 0; Results: = IdHttp.Post (sURL, SendStream); Finally IDHTP free; SendStream.Free; End; End; The exception is: EIdConnClosedGracefully  

The response is:

  & nbsp;  

add 25.1.2009:

Lt;? Xml version = '1.0' encoding = 'us-asci'? & Gt; & Lt ;! DOCTYPE error [& lt ;! ELEMENT error (error message, debugginginfo *) & gt; & Lt ;! ATTLIST error date CDATA # REQUIRED time CDATA # essential & gt; & Lt ;! ELEMENT error message (#PCDATA) & gt; & Lt ;! ELEMENT debuggingInfo (#PCDATA) & gt; ] & Gt; & Lt; Error Date = '01 / 25/2010 'Time = '08: 57: 12' & gt; & Lt; Error Message & gt; XML server error: There was a system error error in the incoming XML response: $ ZE = & amp; Amp; the lift; & Gt; Linux + 196 ^% XLLXNAzer & lt; / Error message & gt;

Resolution 26.1.2009:

  function callRpc (const sURL, sxML: string): string; Var sandstream: tistream; IDHTP: TIDHTP; SNSXML: Anisiting; // & lt; - New start SNSXML: = Sxml; // & lt; - New: Implastic string cast SendStream: = TMemoryStream.Create; IDHTP: TIDHTP. Cut (zero); IWP Try the request. Accept: = '* / *'; IdHttp.Request.ContentType: '' text / sXML '; IdHttp.Request.Connection: 'Keep-Elite'; IdHttp.Request.ContentLength: = Length (SNSXML); // & lt; - New SendStream.Write (SNSXML [1], Length (SNSXML)); // & lt; - New SendStream.Position: = 0; Results: = IdHttp.Post (sURL, SendStream); Finally IDHTP free; SendStream.Free; End;  

end;

See that making a SXML difference makes a difference.

Perhaps the string is in the stream UTF-16 or so on.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -