Hi,

I am trying to deploy the "new" HTTPS POST API via Perl. However, I am getting "Authentication Error" messages (401).

This is what I have:
[...]
       my $ua = LWP::UserAgent->new;
       my $signature = md5_hex(md5_hex($xml, $private_key) , $private_key);
       my $request = POST (
               "https://rr-n1-tor.opensrs.net:55443";,
               'Content-Type' => 'text/xml',
               'X-Username' => $rspusername,
               'X-Signature' => $signature,
               'Content' => $xml
       );
       my $response = $ua->request($request);
       print $response->{'_content'};
[...]


This is what I get:


<?xml version='1.0' encoding="UTF-8" standalone="no" ?>
<!DOCTYPE OPS_envelope SYSTEM "ops.dtd">
<OPS_envelope>
<header>
 <version>0.9</version>
 </header>
<body>
 <data_block>
  <dt_assoc>
   <item key="response_text">Authentication Failed</item>
   <item key="is_success">0</item>
   <item key="response_code">401</item>
   <item key="protocol">XCP</item>
  </dt_assoc>
 </data_block>
</body>
</OPS_envelope>


And this is what I send:


<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!DOCTYPE OPS_envelope SYSTEM "ops.dtd">
<OPS_envelope>
<header>
 <version>0.9</version>
</header>
<body>
   <data_block>
  <dt_assoc>
   <item key="attribute">
    <dt_assoc>
     <item key="reg_password">mypassword</item>
     <item key="domain">mydomain.com</item>
     <item key="reg_username">myusername</item>
    </dt_assoc>
  </item>
  <item key="object">cookie</item>
  <item key="action">set</item>
  <item key="protocol">XCP</item>
 </dt_assoc>
</data_block>
 </body>
</OPS_envelope>


$rspusername, $private_key are OK, double-checked. So is the IP I am connecting from. I have also tried the md5_hex implementation according to the docs - it gave me the correct results. Also tried to send the data to our own webserver, and checked the content length (to see if POST is not appending something wrong, again according to the docs), but it is OK also.


Any ideas? I really don't know how to go any further... :-(

Thanks,
- Csongor Fagyal




Reply via email to