我正在使用perl脚本在REST Client中执行各种方法。 下面是执行POST方法的代码段。
use REST::Client;
use MIME::Base64;
use XML::LibXML;
use Data::Dumper;
use Term::ReadKey;
use XML::Simple;
use JSON;
# Older implementations of LWP check this to disable server verification
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}=0;
my $userid = "username";
my $hostIP = '10.10.10.10';
my $password = "password";
# Create a REST client object for all invocations
my $client = REST::Client->new();
$client->setHost("https://" . $hostIP);
# Newer implementations of LWP use this to disable server verification
# Try SSL_verify_mode => SSL_VERIFY_NONE. 0 is more compatible, but may be deprecated
$client->getUseragent()->ssl_opts( SSL_verify_mode => 0 );
my $headers = {Authorization => 'Basic ' . encode_base64($userid . ':' . $password),
'Content-Type' => $content_type
};
my $data = "<assign-devices>
<added-devices>
<added-device>
<moid>net.abcd.xyz.bcd.abcdefghij:111111</moid>
</added-device>
</added-devices>
</assign-devices>";
$client -> POST($api, $data,$headers);
print $client->responseContent() . "\n";
print $client->responseCode() . "\n";
以上代码绝对没问题。因为我使用了一些其他数据来确保这个代码的功能。但我得到500 Internal Server Error
以获取上述数据。是描述请求体的方式是错误的???我甚至尝试过逃避一些角色。你能帮帮我吗?
Has anyone worked with locking (POST) ? Because, the problem what i'm facing is the step after the locking (POST - perl script). I think this locking is creating a problem.