I am writing a web application that works with the five9 API. I have a working php script that uses the API to print out the email of the first User. My application is in Perl and I am trying to avoid shelling out to a PHP script. I have tried to use SOAP::Lite but am having difficulties. Here is my working PHP script.
#!/usr/bin/php
<?php
$soap = null;
$wsdl = "https://api.five9.com/wsadmin/v2/AdminWebService?wsdl";
$user = "johnsmith@example.com";
$pass = "password";
$soap_options = array("login" => $user, "password" => $pass, "trace" => 1);
$soap = new SoapClient($wsdl, $soap_options);
$arryParams['userNamePattern'] = '';
$result = $soap->getUsersInfo($arryParams);
if(isset($result->return)) {
$objRecords = $result->return;
print $objRecords[0]->generalInfo->EMail;
print "\n";
}
?>
Here is what I have so far working with perl and SOAP::Lite
#!/usr/bin/env perl
use warnings;
use strict;
use MIME::Base64;
use Data::Dumper;
use SOAP::Lite +trace => [ transport => sub { print $_[0]->as_string } ];
my $wsdl_five9 = 'https://api.five9.com/wsadmin/AdminWebService?wsdl&user=johnsmith@example.com';
my $uri = 'https://api.five9.com/wsadmin/AdminWebService';
my $user = 'johnsmith@example.com';
my $password = 'password';
my $authorize = 'Basic '.encode_base64($user . ":" . $password);
my $client = SOAP::Lite->service($wsdl_five9);
$client->on_fault(
sub {
my $soap = shift;
my $res = shift;
if(ref($res) eq '') {
die($res);
} else {
die($res->faultstring);
}
return new SOAP::SOM;
}
);
print "Done\n";
If anyone has experience working with perl and SOAP any insight would be greatly appreciated.