What output does the following script produce?  You should only have to
change the URL.  (Made minor changes to Aaron's)

#---BEGIN---
#!/usr/bin/perl -w

use strict;
use warnings;
use diagnostics;

use RPC::XML::Client;
use Term::ReadKey;
use Data::Dumper;

my $VCL_LOCATION = 'https://<URL>/index.php?mode=xmlrpccall';

$|++;

print "Username: ";
chomp(my $username = <>);

print "Password: ";
ReadMode 2;
chomp(my $password = <>);
ReadMode 0;

my $client = RPC::XML::Client->new($VCL_LOCATION, useragent => ['ssl_opts'
=> {verify_hostname => 0}]);
if (defined($client)) {
print "created RPC::XML client object\n";
}
else {
print "failed to create a new RPC::XML client object, error: " .
($RPC::XML::ERROR || '<none>') . "\n";
exit;
}


$client->useragent->default_header('X-User' => $username);
$client->useragent->default_header('X-Pass' => $password);
$client->useragent->default_header('X-APIVERSION' => 2);

my $response = $client->send_request(("system.listMethods"));
if (!ref($response)) {
print "RPC::XML::Client::send_request failed, error: " . ($RPC::XML::ERROR
|| '<none>') . "\n" . Dumper($response) . "\n";
exit;
}
elsif ($response->is_fault) {
print "RPC::XML::Client::send_request fault occurred, fault code: " .
$response->code . ", fault string: " . $response->string . "\n";
exit;
}

for my $method (@$response) {
print $method->value . "\n";
}
#---END---



On Fri, Oct 12, 2012 at 5:54 PM, Michael Jinks <[email protected]> wrote:

> On Fri, Oct 12, 2012 at 09:36:08PM +0000, Aaron Coburn wrote:
> >
> > > Oh, good!  I was wishing for something like this.
> > >
> > > This looks familiar:
> > >
> > > $ ./vcl-rpcxml.pl
> > > Username: vclsystem
> > > Password:
> > > Can't locate object method "value" via package
> > > "RPC::XML::Client::send_request: HTTP server error: Can't connect to
> > > vlab-a.uchicago.edu:443 (certificate verify failed)" (perhaps you
> forgot
> > > to load "RPC::XML::Client::send_request: HTTP server error: Can't
> > > connect to vlab-a.uchicago.edu:443 (certificate verify failed)"?) at
> > > ./vcl-rpcxml.pl line 28, <> line 2.
> > >
> > > I get the same result whether I enter the correct password or something
> > > deliberately wrong.  So I'm guessing that this is indicating something
> > > missing in my environment, but I know from looking previously that the
> > > RPC::XML::Client directory is complete with a send_request script.
> > >
> >
> > But are you not using a custom-built perl interpreter? You should invoke
> the script with the same perl interpreter that vcld is using; otherwise, it
> will use /usr/bin/perl
>
> I adjusted the script:
>
> #!/usr/local/vcl/perl/bin/perl -w
>
> > The error you see relates to a package not being installed -- either LWP
> or RPC::XML
>
> Yeah, that sure is what it looks like... but both modules are present:
>
> $ sudo /usr/local/vcl/perl/bin/cpan LWP
> Reading '/root/.cpan/Metadata'
>   Database was generated on Fri, 12 Oct 2012 09:07:03 GMT
> LWP is up to date (6.04).
>
> $ sudo /usr/local/vcl/perl/bin/cpan RPC::XML
> Reading '/root/.cpan/Metadata'
>   Database was generated on Fri, 12 Oct 2012 09:07:03 GMT
> RPC::XML is up to date (1.56).
>
>
> --
> Michael Jinks :: [email protected]
> University of Chicago IT Services
>

Reply via email to