cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
229
Views
0
Helpful
0
Comments
cdnadmin
Level 11
Level 11
This document was generated from CDN thread

Created by: Matthew Loraditch on 16-08-2013 08:38:33 AM
I am trying to run an update phone query via SOAP::Lite in a perl script. It appears to work but does not actually do anything. I have used soapUI to generally validate that the axl query I am making works but there are some variations in the XML sent via the perl script vs what I see in soapUI. I have enabled SOAP::Lite tracing so I can see XML sent and the response. The response looks like a good response but when I check CUCM the data has not updated.  Given all this does anyone have any suggestions for modifications to make it work? Something I am missing, etc?
Thanks!

Below are my perl scripts, the xml from the SOAP::Lite trace and the XML from soapUI
 1#!perl.exe
 2BEGIN { $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0 }
 3use warnings;
 4use strict;
 5
 6use Data::Dumper;
 7use Text::CSV;
 8
 9use SOAP::Lite "trace" => ["transport" => \&log_it];
10sub log_it
11{  my ($in) = @_;
12  if (ref $in && $in->can("content"))
13{   printf "**GOT: %sn", (ref $in);
14    print "-"x60, "n";
15    print $in->content, "n";
16    print "-"x60, "n";  }
17}
18
19
20
21
22my $cucmip = "XXXX";
23my $axl_port = "8443";
24my $user = "axlapi";
25my $password = "XXXX";
26my $axltoolkit = "AXLAPI.wsdl";
27my $filename = "users.csv";
28
29
30
31# Make sure the file opens
32open(INPUT, $filename) or die "Cannot open $filename";
33# Read the header line.
34my $line = <INPUT>;
35
36# Read the lines one by one.
37while($line = <INPUT>)
38{
39chomp($line);
40
41    my ($devname, $owner) = split(',', $line);
42
43print "$devname zzz $owner  \n";
44
45BEGIN { 
46sub SOAP::Transport::HTTP::Client::get_basic_credentials
47     {    return ($user => $password)  };
48}
49my $cm = new SOAP::Lite
50    -> encodingStyle('')   
51    -> proxy("https://$cucmip:$axl_port/axl/")   
52    -> uri ("http://www.cisco.com/AXL/API/7.1");
53
54#axl request
55my $res = $cm->updatePhone(SOAP::Data->name('name' => $devname,
56    SOAP::Data->name('ownerUserName' => $owner ), 
57 ) ); # updatePhone
58
59unless ($res->fault) {   
60print Dumper($res->paramsall());
61 } else { 
62 print join ', ',
63  "FAULTCODE: " . $res->faultcode,
64  "FAULTSTRING: " . $res->faultstring;
65}
66}
67close(INPUT);

XML From Soap Trace:
 1Sent:
 2<?xml version="1.0" encoding="UTF-8"?>
 3<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 4<soap:Body>
 5<updatePhone xmlns="http://www.cisco.com/AXL/API/7.1">
 6<name xsi:type="xsd:string">SEPXXXXX</name>
 7<ownerUserName xsi:type="xsd:string">XXXXX</ownerUserName>
 8</updatePhone>
 9</soap:Body>
10</soap:Envelope>
11
12Response:
13<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
14<SOAP-ENV:Header/>
15<SOAP-ENV:Body>
16<axl:updatePhoneResponse xmlns:axl="http://www.cisco.com/AXL/API/7.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><return>{CORRECT GUID OF PHONE}</return>
17</axl:updatePhoneResponse>
18</SOAP-ENV:Body>
19</SOAP-ENV:Envelope>

and what soapUI shows me:
 1Request:
 2<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/9.1">
 3<soapenv:Header/>
 4<soapenv:Body>
 5   <ns:updatePhone sequence="?">
 6       <!--You have a CHOICE of the next 2 items at this level-->
 7         <name>SEPXXX</name> 
 8        <!--Optional:-->
 9          <ownerUserName>XX</ownerUserName>
10        </ns:updatePhone>   
11</soapenv:Body>
12</soapenv:Envelope>
13
14Response:
15<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
16  <soapenv:Body>
17    <ns:updatePhoneResponse sequence="?" xmlns:ns="http://www.cisco.com/AXL/API/9.1">
18         <return>{A1B283DD-98DA-61E4-3053-621AFC2EAF65}</return>
19     </ns:updatePhoneResponse>
20  </soapenv:Body>
21</soapenv:Envelope>


Subject: RE: Update Phone query not working via Perl
Replied by: David Staudt on 16-08-2013 11:30:26 AM
Looks like a schema vs version issue...PERL version appears to be specifying 7.1 schema, and soapUI version is specifying 9.1.  The 7.1 version of updatePhone has <ownerUserId>, where in 9.1 it is <ownerUserName uuid="">.

Subject: RE: Update Phone query not working via Perl
Replied by: Matthew Loraditch on 16-08-2013 11:44:02 AM
So interestingly I did fiddle around with that. If I set the version to be 9.1 in the perl, the response still comes back the same as above with 7.1 listed (and doesn't work)

Subject: RE: Update Phone query not working via Perl
Replied by: Matthew Loraditch on 16-08-2013 12:15:02 PM
Don't suppose you know how to modify the perl to fix that? I've basically borrowed and copied from other examples and am not perl person myself.

Subject: RE: Update Phone query not working via Perl
Replied by: David Staudt on 16-08-2013 12:21:40 PM
I can't spot it in your script above, but at some point you probably consume the AXL wsdl via SOAP::Lite.  If it's the 7.1 wsdl, SOAP::Lite probably generates the 7.1 SOAPAction header when it builds the request.

Subject: RE: Re: New Message from David Staudt in AXL Developer - Administration XML
Replied by: Matthew Loraditch on 16-08-2013 12:35:47 PM
Christopher Lamer:
What version of call manager are you running?  I have lots of perl code I
have written.

Christopher Lamer




From:   Cisco Developer Community Forums <cdicuser@developer.cisco.com>
To:     "cdicuser@developer.cisco.com" <cdicuser@developer.cisco.com>
Date:   08/16/2013 12:24 PM
Subject:        New Message from David Staudt in AXL Developer -
Administration XML Questions: RE: Update Phone query not working via Perl



David Staudt has created a new message in the forum "Administration XML
Questions": --------------------------------------------------------------
I can't spot it in your script above, but at some point you probably
consume the AXL wsdl via SOAP::Lite.  If it's the 7.1 wsdl, SOAP::Lite
probably generates the 7.1 SOAPAction header when it builds the request.
--
To respond to this post, please click the following link:
http://developer.cisco.com/web/axl-developer/forums/-/message_boards/view_message/18335653
or simply reply to this email.

I'm an MSP so many, but I am needing to run this script against 9.1

Subject: RE: Update Phone query not working via Perl
Replied by: David Staudt on 16-08-2013 12:00:00 PM
The version is specified in both the SOAPAction HTTP header (see AXL Dev Guide) and in the XLMNS - if it's still 7.1 in the SOAPAction I think that takes precedence...
 1POST https://10.88.131.141:8443/axl/ HTTP/1.1
 2Accept-Encoding: gzip,deflate
 3Content-Type: text/xml;charset=UTF-8
 4[b]SOAPAction: "CUCM:DB ver=8.5 updatePhone"[/b]
 5Authorization: Basic QWRtaW5pc3RyYXRvcjpjaXNjbyExMjM=
 6Content-Length: 348
 7Host: 10.88.131.141:8443
 8Connection: Keep-Alive
 9User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
10
11<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/8.5">
12   <soapenv:Header/>
13   <soapenv:Body>
14      <ns:updatePhone sequence="1">
15         <name>IPCMRAEU5UCM5X7</name>
16         <description>New Description</description>
17      </ns:updatePhone>
18   </soapenv:Body>
19</soapenv:Envelope>


Subject: Re: New Message from David Staudt in AXL Developer - Administration XML Que
Replied by: Christopher Lamer on 16-08-2013 12:33:43 PM
What version of call manager are you running?  I have lots of perl code I
have written.

Christopher Lamer




From:   Cisco Developer Community Forums <cdicuser@developer.cisco.com>
To:     "cdicuser@developer.cisco.com" <cdicuser@developer.cisco.com>
Date:   08/16/2013 12:24 PM
Subject:        New Message from David Staudt in AXL Developer -
Administration XML Questions: RE: Update Phone query not working via Perl



David Staudt has created a new message in the forum "Administration XML
Questions": --------------------------------------------------------------
I can't spot it in your script above, but at some point you probably
consume the AXL wsdl via SOAP::Lite.  If it's the 7.1 wsdl, SOAP::Lite
probably generates the 7.1 SOAPAction header when it builds the request.
--
To respond to this post, please click the following link:
http://developer.cisco.com/web/axl-developer/forums/-/message_boards/view_message/18335653
or simply reply to this email.

Subject: Re: New Message from Matthew Loraditch in AXL Developer - Administration XM
Replied by: Christopher Lamer on 16-08-2013 12:59:43 PM
This is a sample of how to do it for Ver 8.5 (or 8.6):

#!/usr/bin/perl

use SOAP::Lite;
use Data:umper;

$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;

my $axl_port = "8443";
my $user = "username";
my $password = "password";
my $ver = "8.5";
my $axltoolkit = "http://www.cisco.com/AXL/API/$ver";

my $cucmip = "10.1.1.1";

use SOAP::Lite +trace => 'debug';
$Data:umper::Indent = 1;

    my $axlData = '<name xmlns=""
xsi:type="xsd:string">SEP0123456789ae</name>';
    $axlData .= '<ownerUserName xmlns=""
xsi:type="xsd:string">lamerc</ownerUserName>';

    my $res = updateAXL($axlData,"updatePhone");


sub updateAXL {
  my $updateData = shift;
  my $updateSub = shift;

  BEGIN {
    sub SOAP::Transport::HTTP::Client::get_basic_credentials {
      return ($user => $password)
    };
  }

  my $cm = SOAP::Lite
    -> encodingStyle('')
    -> on_action(sub { return "CUCMB ver=$ver" })
    -> proxy("https://$cucmip:$axl_port/axl/")
    -> uri("http://www.cisco.com/AXL/API/$ver");

  $cm->outputxml('true');

  my $res = $cm->$updateSub(SOAP:ata->type('xml' => $updateData));

    unless ($res->fault) {
      $xmlResponse = $res->paramsall();
    }

    return($xmlResponse);
}


Christopher Lamer




From:   Cisco Developer Community Forums <cdicuser@developer.cisco.com>
To:     "cdicuser@developer.cisco.com" <cdicuser@developer.cisco.com>
Date:   08/16/2013 12:37 PM
Subject:        New Message from Matthew Loraditch in AXL Developer -
Administration XML Questions: RE: Re: New Message from David Staudt in AXL
Developer - Administration XML



Matthew Loraditch has created a new message in the forum "Administration
XML Questions":
--------------------------------------------------------------
Christopher Lamer:
What version of call manager are you running? I have lots of perl code I
have written.

Christopher Lamer




From: Cisco Developer Community Forums <cdicuser@developer.cisco.com>
To: "cdicuser@developer.cisco.com" <cdicuser@developer.cisco.com>
Date: 08/16/2013 12:24 PM
Subject: New Message from David Staudt in AXL Developer -
Administration XML Questions: RE: Update Phone query not working via Perl



David Staudt has created a new message in the forum "Administration XML
Questions": --------------------------------------------------------------

I can't spot it in your script above, but at some point you probably
consume the AXL wsdl via SOAP::Lite. If it's the 7.1 wsdl, SOAP::Lite
probably generates the 7.1 SOAPAction header when it builds the request.
--
To respond to this post, please click the following link:
http://developer.cisco.com/web/axl-developer/forums/-/message_boards/view_message/18335653

or simply reply to this email.

I'm an MSP so many, but I am needing to run this script against 9.1
--
To respond to this post, please click the following link:
http://developer.cisco.com/web/axl-developer/forums/-/message_boards/view_message/18335797
or simply reply to this email.

Subject: RE: Update Phone query not working via Perl
Replied by: Matthew Loraditch on 16-08-2013 01:44:54 PM
Thanks I will give it a whirl.
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links