perl REST :: Client获得500但是使用curl

时间:2014-08-21 21:22:51

标签: perl rest curl

全部,我正在使用PUT使用REST::Client进行休息通话。我一直拿到500,我已经尝试了同样的卷曲:成功

curl -v -i -H "application/xml" -X PUT -u username:password "http://wltxnhjxhdms02.xxxx.com:8080/spectrum/restful/model/0x100c4d?attr=0x1295d&val=true"

这是我的REST::Client代码:

  my $username = 'username';
  my $password = 'password';
  my $headers = {Accept => 'application/xml', Authorization => 'Basic ' . encode_base64($username . ':' . $password)};
  my $client = REST::Client->new();
  $client->setHost('http://wltxnhjxhdms02.xxxx.com:8080');
  $client->PUT('/spectrum/restful/model/'. $_[0] .'?attr=0x1295d&val=false', $headers) || die  "$!";  
  return $client->responseCode();

一位同事用powershell测试了它,没有任何问题

0 个答案:

没有答案