Perl REST调用包含特殊字符

时间:2016-11-29 10:49:49

标签: json perl solr

您好我正在调用从Perl到SoLr的REST调用。以下是包含搜索条件中特殊字符的代码。当我签入SoLr时,调用没有收到完整的json字符串。

#!perl -w
use REST::Client;
use JSON;
use MIME::Base64; 
use Redis;

my %Hash;
my %Data; my %Param; my @DataArray;
$Hash{archiveFlag} = '0';
$Param{Parameter} = "some.545";
$Param{SortBy} = "Age";
$Param{OrderBy} = "Up";
$Data{searchType} = "Fulltext";
$Data{parameters} = \%Param;
$DataArray[0] = \%Data;
$Hash{searchConditionWrapper} = \@DataArray;

my $Data = encode_json \%Hash;
print $Data;    
$url="http://localhost:8181/DashboardDAVE/cont/solr"; 
my $headers = {'Accept' => 'application/json', 'Content-Type' => 'application/json'};
my $client = REST::Client->new();
$client->setHost($url);
$client->GET($Data, $headers);
print $client->responseContent();

以下是错误。 解析json 1时的异常:null

对此的任何帮助都非常感激。

0 个答案:

没有答案