<?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 Re: Perl and AIM: Bad Request (Invalid Header Name) in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Perl-and-AIM-Bad-Request-Invalid-Header-Name/m-p/31896#M16603</link>
    <description>&lt;P&gt;James,&lt;/P&gt;&lt;P&gt;Glad it works now.&lt;/P&gt;&lt;P&gt;On the subject of perl and DPM, DPM is just SIM with some additions. I had great difficulty with DPM because the documentation does not give a clear explanation of&amp;nbsp; exactly how the redirects work - or at least I failed to understand it. I was able to get DPM to work after reading&amp;nbsp;&lt;A href="https://community.developer.cybersource.com/t5/Integration-and-Testing/How-to-use-Direct-Post-Method-with-Python-custom-code/m-p/6770/highlight/true#M4983" target="_self"&gt;this post&lt;/A&gt;&amp;nbsp; which does a much better job of explaining the fundamentals than the DPM documentation does.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;</description>
    <pubDate>Wed, 05 Dec 2012 02:10:41 GMT</pubDate>
    <dc:creator>jgoebel</dc:creator>
    <dc:date>2012-12-05T02:10:41Z</dc:date>
    <item>
      <title>Perl and AIM: Bad Request (Invalid Header Name)</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Perl-and-AIM-Bad-Request-Invalid-Header-Name/m-p/31872#M16591</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have rewritten a working Wordpress website using perl, and the last thing to do is implement Authorize.Net integration before I can replace the original website. Since there doesn't seem to be perl support for DPM yet, I am using AIM. Unfortunately I can't get out of the starting gate. When I post a request, all I get back is: "&amp;lt;h1&amp;gt;Bad Request (Invalid Header Name)&amp;lt;/h1&amp;gt;". My code is below (minus the login information). Any help would be GREATLY appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; my $PostURL = '&lt;A href="https://secure.authorize.net/gateway/transact.dll';" target="_blank"&gt;https://secure.authorize.net/gateway/transact.dll';&lt;/A&gt;&lt;BR /&gt;&amp;nbsp; my %PostVals = {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "x_login"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "XXXXXXX",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "x_tran_key"&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "XXXXXXXXXXXXXX",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "x_test_request"&amp;nbsp;&amp;nbsp;&amp;nbsp; =&amp;gt; "TRUE",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "x_version"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "3.1",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "x_delim_data"&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "TRUE",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "x_delim_char"&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "|",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "x_relay_response"&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "FALSE",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "x_type"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "AUTH_CAPTURE",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "x_method"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "CC",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "x_card_num"&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "4222222222222",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "x_exp_date"&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "0115",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "x_amount"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "1.00",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "x_description"&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "Sample Transaction",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "x_first_name"&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "John",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "x_last_name"&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "Doe",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "x_address"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "1234 Street",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "x_state"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "WA",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "x_zip"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "98004"&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp; };&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; my $UA = LWP::UserAgent-&amp;gt;new( protocols_allowed =&amp;gt; ["https"] );&lt;BR /&gt;&amp;nbsp; my $Request = POST( $PostURL, $PostVals );&lt;BR /&gt;&amp;nbsp; my $Response = $UA-&amp;gt;request( $Request );&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; warn "HOWDY: " . $Response-&amp;gt;content;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;James&lt;/P&gt;</description>
      <pubDate>Tue, 04 Dec 2012 20:06:56 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Perl-and-AIM-Bad-Request-Invalid-Header-Name/m-p/31872#M16591</guid>
      <dc:creator>nontrivial</dc:creator>
      <dc:date>2012-12-04T20:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: Perl and AIM: Bad Request (Invalid Header Name)</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Perl-and-AIM-Bad-Request-Invalid-Header-Name/m-p/31874#M16592</link>
      <description>&lt;P&gt;OK, I dug around on the forums some more (I did before I posted, honest, I just tried harder after), and tried:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; my $Request = HTTP::Request-&amp;gt;new(POST =&amp;gt;"$PostURL");&lt;BR /&gt;&amp;nbsp; $Request-&amp;gt;content_type('application/x-www-form-urlencoded');&lt;BR /&gt;&amp;nbsp; $Request-&amp;gt;content('match=www&amp;amp;errors=0');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Instead of the example code of:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp; my $Request = POST( $PostURL, $PostVals );&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;And I got a response. It was an API error about an invlaid login, but hey, it's progress. :-) I REALLY suggest that the sample perl needs to be updated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;James&lt;/P&gt;</description>
      <pubDate>Tue, 04 Dec 2012 20:19:27 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Perl-and-AIM-Bad-Request-Invalid-Header-Name/m-p/31874#M16592</guid>
      <dc:creator>nontrivial</dc:creator>
      <dc:date>2012-12-04T20:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: Perl and AIM: Bad Request (Invalid Header Name)</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Perl-and-AIM-Bad-Request-Invalid-Header-Name/m-p/31882#M16596</link>
      <description>&lt;P&gt;I believe the problem is that your post values are in a hash (%PostVals), but what you are posting is a scalar.&amp;nbsp; I think this code is incorrect:&lt;/P&gt;&lt;PRE&gt;my %PostVals = {
    "x_login"        =&amp;gt; "XXXXXXX",
    ...
    "x_zip"        =&amp;gt; "98004"    
  };&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;It should be:&lt;/P&gt;&lt;PRE&gt;my $PostVals = {
    "x_login"        =&amp;gt; "XXXXXXX",
    "...
    "x_zip"        =&amp;gt; "98004"    
  };&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;This will create a hash reference, which is what this code is expecting:&lt;/P&gt;&lt;PRE&gt;my $Request = POST( $PostURL, $PostVals );&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Regards,&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;</description>
      <pubDate>Tue, 04 Dec 2012 20:54:36 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Perl-and-AIM-Bad-Request-Invalid-Header-Name/m-p/31882#M16596</guid>
      <dc:creator>jgoebel</dc:creator>
      <dc:date>2012-12-04T20:54:36Z</dc:date>
    </item>
    <item>
      <title>Re: Perl and AIM: Bad Request (Invalid Header Name)</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Perl-and-AIM-Bad-Request-Invalid-Header-Name/m-p/31886#M16598</link>
      <description>&lt;P&gt;John,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the response. In my followup, I added some code and I started getting an API response. Unfortunately it is the dreaded error 13 error, no matter what combination of server and test/production credentials I use. I did try your suggested fix, and that unfortunately didn't seem to help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;James&lt;/P&gt;</description>
      <pubDate>Tue, 04 Dec 2012 21:09:52 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Perl-and-AIM-Bad-Request-Invalid-Header-Name/m-p/31886#M16598</guid>
      <dc:creator>nontrivial</dc:creator>
      <dc:date>2012-12-04T21:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Perl and AIM: Bad Request (Invalid Header Name)</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Perl-and-AIM-Bad-Request-Invalid-Header-Name/m-p/31888#M16599</link>
      <description>&lt;P&gt;Crap, I spoke too soon. I made that change AND reverted the code I change back to the sample code, and it worked! Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;James&lt;/P&gt;</description>
      <pubDate>Tue, 04 Dec 2012 21:11:02 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Perl-and-AIM-Bad-Request-Invalid-Header-Name/m-p/31888#M16599</guid>
      <dc:creator>nontrivial</dc:creator>
      <dc:date>2012-12-04T21:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: Perl and AIM: Bad Request (Invalid Header Name)</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Perl-and-AIM-Bad-Request-Invalid-Header-Name/m-p/31896#M16603</link>
      <description>&lt;P&gt;James,&lt;/P&gt;&lt;P&gt;Glad it works now.&lt;/P&gt;&lt;P&gt;On the subject of perl and DPM, DPM is just SIM with some additions. I had great difficulty with DPM because the documentation does not give a clear explanation of&amp;nbsp; exactly how the redirects work - or at least I failed to understand it. I was able to get DPM to work after reading&amp;nbsp;&lt;A href="https://community.developer.cybersource.com/t5/Integration-and-Testing/How-to-use-Direct-Post-Method-with-Python-custom-code/m-p/6770/highlight/true#M4983" target="_self"&gt;this post&lt;/A&gt;&amp;nbsp; which does a much better job of explaining the fundamentals than the DPM documentation does.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;</description>
      <pubDate>Wed, 05 Dec 2012 02:10:41 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Perl-and-AIM-Bad-Request-Invalid-Header-Name/m-p/31896#M16603</guid>
      <dc:creator>jgoebel</dc:creator>
      <dc:date>2012-12-05T02:10:41Z</dc:date>
    </item>
  </channel>
</rss>

