<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Sending XML using Delphi, cant solve encoding problem. in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Sending-XML-using-Delphi-cant-solve-encoding-problem/m-p/15490#M8818</link>
    <description>&lt;P&gt;Ok, so after much debugging I finally had everything working, and then it just stopped. &amp;nbsp;I sware I had the sample from here:&amp;nbsp;&lt;A href="http://community.developer.authorize.net/t5/News-and-Announcements/New-XML-API-for-Transaction-Processing/td-p/6402" target="_blank"&gt;http://community.developer.authorize.net/t5/News-and-Announcements/New-XML-API-for-Transaction-Processing/td-p/6402&lt;/A&gt;﻿&amp;nbsp;working and responding with "Invalid account", then I changed it to my account and got "invaild CC experation" through MY program.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, to save time, I used a 3rd party program (XML Transmitter) to continue tests in forming my XML. &amp;nbsp;Once it got it trimmed down, I put the XML (which works fine using XML Transmitter) in to my program, but now, even if I put it back to how it was before, all my program ever returns is:&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;lt;code&amp;gt;E00003&amp;lt;/code&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;text&amp;gt;'%' is an unexpected token. The expected token is '?gt;'. Line 1, position 20.&amp;lt;/text&amp;gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have no % anywhere in my XML, however I assume this is an encoding issue as I know Delphi uses %num fro caracters sometimes (%20 is Space), and gt; is a &amp;gt;. &amp;nbsp;Here is exactly what I am sending:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;XML2Send.Add('&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;createTransactionRequest xmlns:xsi="&lt;A href="http://www.w3.org/2001/XMLSchema-instance" target="_blank"&gt;http://www.w3.org/2001/XMLSchema-instance&lt;/A&gt;" xmlns:xsd="&lt;A href="http://www.w3.org/2001/XMLSchema" target="_blank"&gt;http://www.w3.org/2001/XMLSchema&lt;/A&gt;" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;merchantAuthentication&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;name&amp;gt;myName123&amp;lt;/name&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;transactionKey&amp;gt;MyKey1234567890t&amp;lt;/transactionKey&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;/merchantAuthentication&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;transactionRequest&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;transactionType&amp;gt;authCaptureTransaction&amp;lt;/transactionType&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;amount&amp;gt;365.51&amp;lt;/amount&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;payment&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;creditCard&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;cardNumber&amp;gt;5424000000000015&amp;lt;/cardNumber&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;expirationDate&amp;gt;1112&amp;lt;/expirationDate&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;/creditCard&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;/payment&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;/transactionRequest&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;/createTransactionRequest&amp;gt;');﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am so mad it was working fine and then just stopped (?!?!?). &amp;nbsp;Does anyone know how to get it working again?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FYI: XML2Send is a TStringList, but it only works if the entire XML is in the 1st string (so it is a list of one string). &amp;nbsp;I am using Indy TIdHttp to send with the following command:&lt;/P&gt;&lt;P&gt;XMLResponse := AuthNetHTTP.Post('&lt;A href="https://api.authorize.net/xml/v1/request.api'," target="_blank"&gt;https://api.authorize.net/xml/v1/request.api',&lt;/A&gt; XML2Send);﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 01 Aug 2011 09:59:32 GMT</pubDate>
    <dc:creator>rpmccormick</dc:creator>
    <dc:date>2011-08-01T09:59:32Z</dc:date>
    <item>
      <title>Sending XML using Delphi, cant solve encoding problem.</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Sending-XML-using-Delphi-cant-solve-encoding-problem/m-p/15490#M8818</link>
      <description>&lt;P&gt;Ok, so after much debugging I finally had everything working, and then it just stopped. &amp;nbsp;I sware I had the sample from here:&amp;nbsp;&lt;A href="http://community.developer.authorize.net/t5/News-and-Announcements/New-XML-API-for-Transaction-Processing/td-p/6402" target="_blank"&gt;http://community.developer.authorize.net/t5/News-and-Announcements/New-XML-API-for-Transaction-Processing/td-p/6402&lt;/A&gt;﻿&amp;nbsp;working and responding with "Invalid account", then I changed it to my account and got "invaild CC experation" through MY program.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, to save time, I used a 3rd party program (XML Transmitter) to continue tests in forming my XML. &amp;nbsp;Once it got it trimmed down, I put the XML (which works fine using XML Transmitter) in to my program, but now, even if I put it back to how it was before, all my program ever returns is:&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;lt;code&amp;gt;E00003&amp;lt;/code&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;text&amp;gt;'%' is an unexpected token. The expected token is '?gt;'. Line 1, position 20.&amp;lt;/text&amp;gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have no % anywhere in my XML, however I assume this is an encoding issue as I know Delphi uses %num fro caracters sometimes (%20 is Space), and gt; is a &amp;gt;. &amp;nbsp;Here is exactly what I am sending:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;XML2Send.Add('&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;createTransactionRequest xmlns:xsi="&lt;A href="http://www.w3.org/2001/XMLSchema-instance" target="_blank"&gt;http://www.w3.org/2001/XMLSchema-instance&lt;/A&gt;" xmlns:xsd="&lt;A href="http://www.w3.org/2001/XMLSchema" target="_blank"&gt;http://www.w3.org/2001/XMLSchema&lt;/A&gt;" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;merchantAuthentication&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;name&amp;gt;myName123&amp;lt;/name&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;transactionKey&amp;gt;MyKey1234567890t&amp;lt;/transactionKey&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;/merchantAuthentication&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;transactionRequest&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;transactionType&amp;gt;authCaptureTransaction&amp;lt;/transactionType&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;amount&amp;gt;365.51&amp;lt;/amount&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;payment&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;creditCard&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;cardNumber&amp;gt;5424000000000015&amp;lt;/cardNumber&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;expirationDate&amp;gt;1112&amp;lt;/expirationDate&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;/creditCard&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;/payment&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;/transactionRequest&amp;gt;' +&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'&amp;lt;/createTransactionRequest&amp;gt;');﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am so mad it was working fine and then just stopped (?!?!?). &amp;nbsp;Does anyone know how to get it working again?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FYI: XML2Send is a TStringList, but it only works if the entire XML is in the 1st string (so it is a list of one string). &amp;nbsp;I am using Indy TIdHttp to send with the following command:&lt;/P&gt;&lt;P&gt;XMLResponse := AuthNetHTTP.Post('&lt;A href="https://api.authorize.net/xml/v1/request.api'," target="_blank"&gt;https://api.authorize.net/xml/v1/request.api',&lt;/A&gt; XML2Send);﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2011 09:59:32 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Sending-XML-using-Delphi-cant-solve-encoding-problem/m-p/15490#M8818</guid>
      <dc:creator>rpmccormick</dc:creator>
      <dc:date>2011-08-01T09:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: Sending XML using Delphi, cant solve encoding problem.</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Sending-XML-using-Delphi-cant-solve-encoding-problem/m-p/15540#M8843</link>
      <description>&lt;P&gt;Here is the complete function code as it stands now (I had thought assigning the XML to a sting first, and then assigning that sting to the TStringList might fix it, as I was doing that before when it worked, but still no love). &amp;nbsp;I just can't believe it worked before, and no it has some dumb encoding issue that I cannot solve for the life of me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;procedure TMainForm.WelcomeProcessButtClick(Sender: TObject);
var
  AuthNetHTTP: TIdHttp;
  AuthNetSSL: TIdSSLIOHandlerSocketOpenSSL;
  XMLRequest: TStringList;
  XML2Send, XMLResponse: String;
 begin
  SQLStatusBar.Panels[1].Text := 'Loading Database';
  SQLStatusBar.Panels[2].Text := 'Processing Payments...';
  MainForm.Update;

  //Auth.net
  XML2Send := '&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;' +
               '&amp;lt;createTransactionRequest xmlns:xsi="&lt;A href="http://www.w3.org/2001/XMLSchema-instance" target="_blank"&gt;http://www.w3.org/2001/XMLSchema-instance&lt;/A&gt;" xmlns:xsd="&lt;A href="http://www.w3.org/2001/XMLSchema" target="_blank"&gt;http://www.w3.org/2001/XMLSchema&lt;/A&gt;" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"&amp;gt;' +
                 '&amp;lt;merchantAuthentication&amp;gt;' +
                   '&amp;lt;name&amp;gt;MyNameW8g&amp;lt;/name&amp;gt;' +
                   '&amp;lt;transactionKey&amp;gt;MyTransKeynL479t&amp;lt;/transactionKey&amp;gt;' +
                 '&amp;lt;/merchantAuthentication&amp;gt;' +
                 '&amp;lt;transactionRequest&amp;gt;' +
                   '&amp;lt;transactionType&amp;gt;authCaptureTransaction&amp;lt;/transactionType&amp;gt;' +
                   '&amp;lt;amount&amp;gt;365.51&amp;lt;/amount&amp;gt;' +
                   '&amp;lt;payment&amp;gt;' +
                     '&amp;lt;creditCard&amp;gt;' +
                       '&amp;lt;cardNumber&amp;gt;5424000000000015&amp;lt;/cardNumber&amp;gt;' +
                       '&amp;lt;expirationDate&amp;gt;1112&amp;lt;/expirationDate&amp;gt;' +
                     '&amp;lt;/creditCard&amp;gt;' +
                   '&amp;lt;/payment&amp;gt;' +
                   {'&amp;lt;order&amp;gt;' +
                     '&amp;lt;invoiceNumber&amp;gt;DemoHotel-0611&amp;lt;/invoiceNumber&amp;gt;' +
                     '&amp;lt;description&amp;gt;June 2011 payment from DemoHotel&amp;lt;/description&amp;gt;' +
                   '&amp;lt;/order&amp;gt;' +}
                 '&amp;lt;/transactionRequest&amp;gt;' +
               '&amp;lt;/createTransactionRequest&amp;gt;';
  XMLRequest := TStringList.Create;
  XMLRequest.Append(XML2Send);

  //Prep Web Request
  AuthNetHTTP := TidHTTP.Create(nil);
  AuthNetSSL := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
  AuthNetSSL.SSLOptions.Method := sslvSSLv3;
  AuthNetHTTP.IOHandler := AuthNetSSL;
  AuthNetHTTP.Request.ContentType := 'text/xml';
  AuthNetHTTP.ConnectTimeout := 10000;
  AuthNetHTTP.ReadTimeout := 10000;
  //AuthNetHTTP.Request.ContentEncoding := 'utf-8';
  try
    XMLResponse := AuthNetHTTP.Post('&lt;A href="https://api.authorize.net/xml/v1/request.api'," target="_blank"&gt;https://api.authorize.net/xml/v1/request.api',&lt;/A&gt; XMLRequest);
    AuthNetHTTP.Disconnect;
  except on e: exception do
    ShowMessage('Server Error: ' + e.message);
   end;

  ShowMessage(XMLResponse);

  AuthNetHTTP.Free;
  AuthNetSSL.Free;
  XMLRequest.Free;

  Step2.Visible := True;
  SQLStatusBar.Panels[1].Text := 'Payments Processed!';
  SQLStatusBar.Panels[2].Text := 'Idle.';
  MainForm.Update;
 end;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Please help.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2011 21:41:31 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Sending-XML-using-Delphi-cant-solve-encoding-problem/m-p/15540#M8843</guid>
      <dc:creator>rpmccormick</dc:creator>
      <dc:date>2011-08-01T21:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: Sending XML using Delphi, cant solve encoding problem.</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Sending-XML-using-Delphi-cant-solve-encoding-problem/m-p/15542#M8844</link>
      <description>&lt;P&gt;Here is the complete response (starting with a few random chars???):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ï»¿&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;ErrorResponse xmlns:xsi="&lt;A href="http://www.w3.org/2001/XMLSchema-instance" target="_blank"&gt;http://www.w3.org/2001/XMLSchema-instance&lt;/A&gt;" xmlns:xsd="&lt;A href="http://www.w3.org/2001/XMLSchema" target="_blank"&gt;http://www.w3.org/2001/XMLSchema&lt;/A&gt;" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"&amp;gt;
  &amp;lt;messages&amp;gt;
    &amp;lt;resultCode&amp;gt;Error&amp;lt;/resultCode&amp;gt;
    &amp;lt;message&amp;gt;
      &amp;lt;code&amp;gt;E00003&amp;lt;/code&amp;gt;
      &amp;lt;text&amp;gt;'%' is an unexpected token. The expected token is '?&amp;amp;gt;'. Line 1, position 20.&amp;lt;/text&amp;gt;
    &amp;lt;/message&amp;gt;
  &amp;lt;/messages&amp;gt;
&amp;lt;/ErrorResponse&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2011 21:45:05 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Sending-XML-using-Delphi-cant-solve-encoding-problem/m-p/15542#M8844</guid>
      <dc:creator>rpmccormick</dc:creator>
      <dc:date>2011-08-01T21:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: Sending XML using Delphi, cant solve encoding problem.</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Sending-XML-using-Delphi-cant-solve-encoding-problem/m-p/15548#M8847</link>
      <description>&lt;P&gt;Alright, well, even though I could sware it worked a few times with a TStringList, in the end the answer was just to change it to a TStringStream which is not encoded.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the working code for anybody looking for the easiest way to use AIM over XML in Delphi using Indy:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;procedure TMainForm.ProcessButtClick(Sender: TObject);
var
  AuthNetHTTP: TIdHttp;
  AuthNetSSL: TIdSSLIOHandlerSocketOpenSSL;
  XMLRequest: TStringStream;
  XMLResponse: String;
 begin
  XMLRequest := TStringStream.Create(
               '&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;' +
               '&amp;lt;createTransactionRequest xmlns:xsi="&lt;A href="http://www.w3.org/2001/XMLSchema-instance" target="_blank"&gt;http://www.w3.org/2001/XMLSchema-instance&lt;/A&gt;" xmlns:xsd="&lt;A href="http://www.w3.org/2001/XMLSchema" target="_blank"&gt;http://www.w3.org/2001/XMLSchema&lt;/A&gt;" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"&amp;gt;' +
                 '&amp;lt;merchantAuthentication&amp;gt;' +
                   '&amp;lt;name&amp;gt;YourName.&amp;lt;/name&amp;gt;' +
                   '&amp;lt;transactionKey&amp;gt;YourTransKey....&amp;lt;/transactionKey&amp;gt;' +
                 '&amp;lt;/merchantAuthentication&amp;gt;' +
                 '&amp;lt;transactionRequest&amp;gt;' +
                   '&amp;lt;transactionType&amp;gt;authCaptureTransaction&amp;lt;/transactionType&amp;gt;' +
                   '&amp;lt;amount&amp;gt;365.51&amp;lt;/amount&amp;gt;' +
                   '&amp;lt;payment&amp;gt;' +
                     '&amp;lt;creditCard&amp;gt;' +
                       '&amp;lt;cardNumber&amp;gt;5424000000000015&amp;lt;/cardNumber&amp;gt;' +
                       '&amp;lt;expirationDate&amp;gt;1118&amp;lt;/expirationDate&amp;gt;' +
                     '&amp;lt;/creditCard&amp;gt;' +
                   '&amp;lt;/payment&amp;gt;' +
                 '&amp;lt;/transactionRequest&amp;gt;' +
               '&amp;lt;/createTransactionRequest&amp;gt;');

  //Prep Web Request
  AuthNetHTTP := TidHTTP.Create(nil);
  AuthNetSSL := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
  AuthNetSSL.SSLOptions.Method := sslvSSLv3;
  AuthNetHTTP.IOHandler := AuthNetSSL;
  AuthNetHTTP.Request.ContentType := 'text/xml';
  AuthNetHTTP.ConnectTimeout := 10000;
  AuthNetHTTP.ReadTimeout := 10000;
  try
    XMLResponse := AuthNetHTTP.Post('&lt;A href="https://api.authorize.net/xml/v1/request.api'," target="_blank"&gt;https://api.authorize.net/xml/v1/request.api',&lt;/A&gt; XMLRequest);
    AuthNetHTTP.Disconnect;
  except on e: exception do
    ShowMessage('Server Error: ' + e.message);
   end;

  Memo1.Text := XMLResponse;
  ShowMessage(XMLResponse);

  AuthNetHTTP.Free;
  AuthNetSSL.Free;
  XMLRequest.Free;
 end;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2011 03:36:05 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Sending-XML-using-Delphi-cant-solve-encoding-problem/m-p/15548#M8847</guid>
      <dc:creator>rpmccormick</dc:creator>
      <dc:date>2011-08-02T03:36:05Z</dc:date>
    </item>
  </channel>
</rss>

