Using perl for accessing AXl

Version 1
    This document was generated from CDN thread

    Created by: Chandar vr on 09-09-2009 10:02:25 AM
    Hi,
     
    I have written a small perl script to execute a sql query and return the data after the execution.
     
    But i am getting the error Null SQL statement.
     
    I am attaching the code below
     
     1
     2#!/opt/perl/bin/perl
     3print "Content-type: text/html\n\n";
     4use SOAP::Lite +trace;
     5BEGIN {
     6sub SOAP::Transport::HTTP::Client::get_basic_credentials {
     7    return 'user' => 'pwd';
     8  }
     9}
    10$cm = new SOAP::Lite
    11    uri => 'file:/path/AXLAPI.wsdl',
    12    proxy => "[url= ]https://[cucm]:8443/axl/[/url]";
    13print "this is ".$cm;
    14$res = $cm->executeSQLQuery("select * from device");
    15
    16unless ($res->fault) {
    17    print Dumper($res->paramsall());
    18    }
    19 else {
    20        print join ', ',
    21        $res->faultcode,
    22        $res->faultstring;
    23}

     
    Please help me on this ..

    Subject: RE: Using perl for accessing AXl
    Replied by: Thomas Beck on 12-10-2009 07:02:29 PM
    Hi,
    try this litte example:
     1
     2#!/usr/bin/perl
     3
     4use warnings;
     5use strict;
     6use SOAP::Lite;
     7use Data::Dumper;
     8
     9my $DEBUG = 1;
    10my $cucmip = '127.0.0.1';
    11my $axl_port = '8443';
    12my $user = 'AXLUSER';
    13my $password = 'AXLPASS';
    14my $error_text;
    15
    16BEGIN {
    17  sub SOAP::Transport::HTTP::Client::get_basic_credentials {
    18    return ($user => $password)
    19  };
    20}
    21
    22use SOAP::Lite +trace => 'debug';
    23
    24my $cm = new SOAP::Lite
    25    encodingStyle => '',
    26    uri => 'http://www.cisco.com/AXL/API/1.0',
    27    proxy => "https://$cucmip:$axl_port/axl/" ;
    28
    29my $axl_sql = "SELECT * FROM device";
    30
    31print "\$axl_sql: $axl_sql\n" if ( $DEBUG==1);
    32my $data = SOAP::Data->name( "sql" => $axl_sql );
    33my $res = $cm->executeSQLQuery( $data );
    34unless ($res->fault) {
    35  $Data::Dumper::Indent = 3;
    36  print Dumper($res->paramsall()) if ( $DEBUG==1);
    37} else {
    38  $error_text = $res->faultcode.' '.$res->faultstring."\n";
    39  print $error_text;
    40}

    Hope this will help you.