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}
1819202122my $cucmip = "XXXX";
23my $axl_port = "8443";
24my $user = "axlapi";
25my $password = "XXXX";
26my $axltoolkit = "AXLAPI.wsdl";
27my $filename = "users.csv";
28293031# Make sure the file opens
32open(INPUT, $filename) or die "Cannot open $filename";
33# Read the header line.
34my $line = <INPUT>;
3536# Read the lines one by one.
37while($line = <INPUT>)
38{
39chomp($line);
4041 my ($devname, $owner) = split(',', $line);
4243print "$devname zzz $owner \n";
4445BEGIN {
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");5354#axl request
55my $res = $cm->updatePhone(SOAP::Data->name('name' => $devname,
56 SOAP::Data->name('ownerUserName' => $owner ),
57 ) ); # updatePhone
5859unless ($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:and what soapUI shows me:Subject: RE: Update Phone query not working via Perl Replied by: David Staudt on 16-08-2013 11:30:26 AMLooks 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 AMSo 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 PMDon'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 PMI 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 PMChristopher 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.1Subject: RE: Update Phone query not working via Perl Replied by: David Staudt on 16-08-2013 12:00:00 PMThe 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 PMWhat version of call manager are you running? I have lots of perl code I have written.Christopher LamerFrom: Cisco Developer Community Forums <cdicuser@developer.cisco.com>To: "cdicuser@developer.cisco.com" <cdicuser@developer.cisco.com>Date: 08/16/2013 12:24 PMSubject: New Message from David Staudt in AXL Developer - Administration XML Questions: RE: Update Phone query not working via PerlDavid 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 PMThis is a sample of how to do it for Ver 8.5 (or 8.6):#!/usr/bin/perluse 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 "CUCM
B 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 LamerFrom: Cisco Developer Community Forums <cdicuser@developer.cisco.com>To: "cdicuser@developer.cisco.com" <cdicuser@developer.cisco.com>Date: 08/16/2013 12:37 PMSubject: New Message from Matthew Loraditch in AXL Developer - Administration XML Questions: RE: Re: New Message from David Staudt in AXL Developer - Administration XMLMatthew 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 LamerFrom: Cisco Developer Community Forums <cdicuser@developer.cisco.com>To: "cdicuser@developer.cisco.com" <cdicuser@developer.cisco.com>Date: 08/16/2013 12:24 PMSubject: New Message from David Staudt in AXL Developer - Administration XML Questions: RE: Update Phone query not working via PerlDavid 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 PMThanks I will give it a whirl.