[Chicago-talk] LWP Error
richard at rushlogistics.com
richard at rushlogistics.com
Mon Dec 28 12:13:07 PST 2015
I am having trouble making calls to a REST application with LWP despite having my IP whitelisted by the service and was wondering if anyone might know what I am doing wrong.
my $ua = LWP::UserAgent->new;
my $data = {
source => 'MYSOURCE',
userid => 'MYUSERID,
password => 'mypassword',
scope => 'my scope',
};
use JSON::PP;
my $js = JSON::PP->new;
$js->canonical(1);
my $json_string = $js->encode($data);
#print "Jason String: " . $json_string . "\n";
$ua->default_header("Content-Type" => "application/json");
my $response = $ua->post("https://api-sandbox.networkforgood.org/access/rest/token", Content => $json_string);
print $response->as_string;
I have verified that $json_string is correctly serialized. Here is the response I get back:
HTTP/1.1 400 Bad Request
Cache-Control: private
Date: Mon, 28 Dec 2015 19:48:59 GMT
Server: Microsoft-IIS/8.0
Content-Length: 1647
Content-Type: text/html
Client-Date: Mon, 28 Dec 2015 19:48:54 GMT
Client-Peer: 68.64.143.14:443
Client-Response-Num: 1
Client-SSL-Cert-Issuer: /C=US/O=GeoTrust Inc./CN=GeoTrust SSL CA - G3
Client-SSL-Cert-Subject: /C=US/ST=District Of Columbia/L=Washington/O=Network For Good/OU=Network For Good Web Sites/CN=*.networkforgood.org
Client-SSL-Cipher: ECDHE-RSA-AES128-SHA256
Client-SSL-Socket-Class: IO::Socket::SSL
Set-Cookie: ASP.NET_SessionId=4aaivqosmxn1bxdsszvvsqxm; path=/; HttpOnly
Set-Cookie: NfgPrimaryKey=56e913bc-823b-4cfe-9968-98575631b6e7; expires=Tue, 27-Dec-2016 19:48:59 GMT; path=/
Title: Request Error
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Request Error</title>
<style>BODY { color: #000000; background-color: white; font-family: Verdana; margin-left: 0px; margin-top: 0px; } #content { margin-left: 30px; font-size: .70em; padding-bottom: 2em; } A:link { color: #336699; font-weight: bold; text-decoration: underline; } A:visited { color: #6699cc; font-weight: bold; text-decoration: underline; } A:active { color: #336699; font-weight: bold; text-decoration: underline; } .heading1 { background-color: #003366; border-bottom: #336699 6px solid; color: #ffffff; font-family: Tahoma; font-size: 26px; font-weight: normal;margin: 0em 0em 10px -20px; padding-bottom: 8px; padding-left: 30px;padding-top: 16px;} pre { font-size:small; background-color: #e5e5cc; padding: 5px; font-family: Courier New; margin-top: 0px; border: 1px #f0f0e0 solid; white-space: pre-wrap; white-space: -pre-wrap; word-wrap: break-word; } table { border-collapse: collapse; border-spacing: 0px; font-family: Verdana;} table th { border-right: 2px white solid; border-bottom: 2px white solid; font-weight: bold; background-color: #cecf9c;} table td { border-right: 2px white solid; border-bottom: 2px white solid; background-color: #e5e5cc;}</style>
</head>
<body>
<div id="content">
<p class="heading1">Request Error</p>
<p>The server encountered an error processing the request. See server logs for more details.</p>
</div>
</body>
</html>
More information about the Chicago-talk
mailing list