cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2171
Views
2
Helpful
10
Replies
Highlighted

Perl not working CUCM 10.5

Hi,

this little Perl is working fine with CUCM 8.6 and 9.1 but not with 10.5.

When I use this Perl with 10.5 I can`t get any reply such as device_name or device_description.

What I have to change in the Perl so that it will be work with CUCM 10.5?

###Begin####################################################################################################################################

#!/usr/bin/perl

$cucm_ip = 'ip-address'; 

$user_axl = 'user';          

$password_axl = 'pwd';

$path_file=$path."input.txt";

############################################################################################################################################

$ENV{PERL_NET_HTTPS_SSL_SOCKET_CLASS} = "Net::SSL";

$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;

use DBI;

use SOAP::Lite;

BEGIN

{

  sub SOAP::Transport::HTTP::Client::get_basic_credentials

  {

    return

    ($user_axl => $password_axl)

  }

}

my $CUCM = SOAP::Lite

  ->uri("http://www.cisco.com/AXL/API/1.0")

  ->proxy("https://$cucm_ip/axl/");

if (-e $path_file)

{

  print "File exits\n";

  print ON "File exits\n";

  open(IN,"$path_file");

  while (<IN>)

  {

    print "==\n";

    $devname=""; 

    $line=$_;

    chomp($line);

    @values=split(/\;/,$line,1);

    $devname=(shift @values);

    print "Input:".$devname."\n";  

############################################################################################################################################

    $res =

      $CUCM->executeSQLQuery(

      SOAP::Data->name('sql' => "select pkid, name, description from device where name='$devname'")

      );

    $_device_pkid=$res->valueof('//return/row/pkid');

    $_device_name=$res->valueof('//return/row/name');

    $_device_description=$res->valueof('//return/row/description');

    print "Device Name:".$_device_name."\n";

    print "Device Desc:".$_device_description."\n";

    print "---\n";

############################################################################################################################################

  }

}

else

{

  print "File not found\n";

}

###End######################################################################################################################################

BR

Michael

10 REPLIES 10
Cisco Employee

Re: Perl not working CUCM 10.5

I suspect the problem is the '1.0' version namespace specified in the code:

  ->uri("http://www.cisco.com/AXL/API/1.0")

UCM 10.5 does not support this very old namespace version...previous UCM versions may have been less strict in checking.  You will want to update to one of the versions supported by 10.5.  More details here:

https://developer.cisco.com/media/manager-xml-developer-guide/index.html?versioning.html

Re: Perl not working CUCM 10.5

Hi David,

many thanks for reply.

This uri I already changed to ("http://www.cisco.com/AXL/API/10.0") but this was also not working.

BR

Michael

Cisco Employee

Re: Perl not working CUCM 10.5

Note also that the SOAPAction: header must also be present.  If you can get a look at the actual HTTP request, it should look something like the below (note this request is against UCM 10.5:)

POST https://10.53.205.46:8443/axl/ HTTP/1.1

Accept-Encoding: gzip,deflate

Content-Type: text/xml;charset=UTF-8

SOAPAction: "CUCM:DB ver=10.5 getUser"

Authorization: Basic QWRtaW5pc3RyYXRvcjpjaXNjb3BzZHQ=

Content-Length: 358

Host: 10.53.205.46:8443

Connection: Keep-Alive

User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/10.5">

   <soapenv:Header/>

   <soapenv:Body>

      <ns:getUser sequence="1">

         <userid>dstaudt</userid>

         <returnedTags>

            <lastName/>

         </returnedTags>

      </ns:getUser>

   </soapenv:Body>

</soapenv:Envelope>


Re: Perl not working CUCM 10.5

Hi David,

sorry for the maybe stupid questions :-)

- How can I look into the http-request? I only have this perl and normally a output when I use the perl with CUCM 8.x or 9.x

- Where do I have to use / insert your posted rows? Into the perl-script?

BR

Michael

Cisco Employee

Re: Perl not working CUCM 10.5

The HTTP request above would be the output of the SOAP::lite library, as it appears on the wire.  I don't know enough about SOAP::lite to know how you can dump/view the HTTP request as its sent - if there isn't an easy way you could use something like Fiddler.

I think the key will be to understand if SOAP::lite is including the 'SOAPAction:' header (with the right version for your system), or if your code needs to specifically add that header to the request before sending...

You may also be able to get more information by looking at the AXL service logs, available using the UCM Real Time Monitoring Tool (RTMT)

Beginner

Re: Perl not working CUCM 10.5

I had the exact same problem today after we upgraded to CUCM 10.5. I was able to get Perl working by changing my SOAP::Lite contsructor to look like this:

   # The SOAP object to talk to call manager

   my $cm = new SOAP::Lite

   encodingStyle => '',

   uri => 'CUCM:DB ver=10.5',

   ns => 'http://www.cisco.com/AXL/API/10.5',

   proxy => [

              "https://$uprefs->{CMServer}:$uprefs->{CMPort}/axl/",

              ssl_opts => { verify_hostname => 0 },

              credentials => [

                 "$uprefs->{CMServer}:$uprefs->{CMPort}",   # host:port

                 'Cisco AXL API',                             # Realm

                 $uprefs->{CMUser} => $uprefs->{CMPass},      # user, password

              ],

   ];

   $cm->on_action( sub { join ' ', @_ } );

Setting the URI to 'CUCM::DB ver=10.5' and adding the "on_action" hook at the bottom fixed the SOAPAction header but then I got namespace errors which I corrected by manually adding the "ns" setting in the constructor above. This works for me now.

Beginner

Re: Perl not working CUCM 10.5

Thanks.  Got me running with Perl and 10.5

Beginner

Re: Perl not working CUCM 10.5

Hello Martin,

     I have been wanting to get started in the world of AXL but did not now how to start. I copied your code and installed DBI and SOAP::Lite, but I get the following error, do you know what this may be related to?

" 500 Can't locate object method "new" via package "LWP::Protocol::https::Socket" at cucmInterface.pl line 40.

Line 50 is the following for me:

$res = $CUCM ->executeSQLQuery(SOAP::Data->name('sql' => "select pkid, name, description from device where name='$devname'"));

Thanks for your help.

Cisco Employee

Re: Perl not working CUCM 10.5

No specific guidance (I'm not a Perl guy), but just to note that SOAP frameworks (like SOAP::Lite) tend to not be able to handle 'freeform' XML results, i.e. what you get from an <executeSqlQuery> request.  You may want to handle such requests as an HTTP/XML transaction, rather than trying to have it processed by a SOAP framework...

Beginner

Re: Perl not working CUCM 10.5

@dstaudt Thank you, I solved my issue by commenting out the following line $ENV{PERL_NET_HTTPS_SSL_SOCKET_CLASS} = "Net::SSL";

Now, in addition to the info that the original script collects, I need to gather the phones IP, registration status and Dn(s) configured on it. do you have any Idea how to get that info? And where I could look as to see what all possibilities there are?

CreatePlease to create content
Content for Community-Ad
August's Community Spotlight Awards