Note that there are some explanatory texts on larger screens.

plurals
  1. POIdHttp Post Method Delphi 2010
    primarykey
    data
    text
    <p>Like others before me, I'm having troubles using the IdHttp(Indy 10.5.5) component in Delphi 2010. The code works fine in Delphi 7:</p> <pre><code>var XMLString : AnsiString; lService : AnsiString; ResponseStream: TMemoryStream; InputStringList : TStringList; begin ResponseStream := TMemoryStream.Create; InputStringList := TStringList.Create; XMLString :='&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt; '+ '&lt;!DOCTYPE pnet_imessage_send PUBLIC "-//PeopleNet//pnet_imessage_send" "http://open.peoplenetonline.com/dtd/pnet_imessage_send.dtd"&gt; '+ '&lt;pnet_imessage_send&gt; '+ ' &lt;cid&gt;username&lt;/cid&gt; '+ ' &lt;pw&gt;password&lt;/pw&gt; '+ ' &lt;vehicle_number&gt;tr01&lt;/vehicle_number&gt; '+ ' &lt;deliver&gt;now&lt;/deliver&gt; '+ ' &lt;action&gt; '+ ' &lt;action_type&gt;reply_with_freeform&lt;/action_type&gt; '+ ' &lt;urgent_reply&gt;yes&lt;/urgent_reply&gt; '+ ' &lt;/action&gt; '+ ' &lt;freeform_message&gt;Test Message Version 2&lt;/freeform_message&gt; '+ '&lt;/pnet_imessage_send&gt; '; lService := 'imessage_send'; InputStringList.Values['service'] := lService; InputStringList.Values['xml'] := XMLString; try IdHttp1.Request.Accept := '*/*'; IdHttp1.Request.ContentType := 'text/XML'; IdHTTP1.Post('http://open.peoplenetonline.com/scripts/open.dll', InputStringList, ResponseStream); ... finally ResponseStream.Free; InputStringList.Free; end; </code></pre> <p>The only differences so far between this and the D7 code is that I've changed the String types to AnsiString, and added the HTTP Request properties. </p> <p>The response I get back from the server is 'XML failed to parse. Whitespace expected at Line:1 Position: 19', I'm assuming the XML got garbled up somewhere in the process, but I can't figure our where I'm going wrong.</p> <p>Any ideas? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload