Poj
You have me very close to figuring this out. I am uncertain that you are a Cisco Voice guy, so you may not have a solution to my current issues, but I will post my updated code below. I do get errors printed out to the file and the errors seem to come from Cisco Communications manager. What you could help me with is being able to set up Children for the "SelectItems" element. As you can see my updated code, I did this is a very naive way, I think.
#!/usr/bin/perl
my $cucm_ip = "10.74.13.228";
my $user_axl = "user";
my $password_axl = "password";
my $dev ="SEPE8BA70FB8CB5";
######################################################################
+#########################
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
use SOAP::Lite;
BEGIN
{
sub SOAP::Transport::HTTP::Client::get_basic_credentials
{
return
($user_axl => $password_axl)
}
}
my $CUCM = SOAP::Lite
->uri("http://schemas.cisco.com/ast/soap/action/#RisPort#
+selectCmDevice") #->uri("http://schemas.cisco.com/ast/soap/")
->proxy("https://$cucm_ip:8443/realtimeservice/services/Ris
+Port"); ###Maybe ?wsdl");
#->proxy("loopback://");
$CUCM->outputxml(1);
$CUCM->readable(1);
#$CUCM->envprefix('soapenv');
#$CUCM->ns($uri,'soap');
$CUCM->autotype(0);
print "The Device $dev\n\n\n";
#####i################################################################
+#############################
my %select =(
"MaxReturnedDevices" => 200,
"DeviceClass" => "Any",
"Model" => 255,
"Status" => 'Any',
"NodeName" => '',
"SelectBy" => 'Name',
"SelectItems" => "<item><Item>$dev</Item></item>",
"Protocol" => 'Any',
"DownloadStatus" => 'Any' );
#################################################################
my $state = SOAP::Data->name('StateInfo','');
my $data = SOAP::Data->name('CmSelectionCriteria' , => \%select);
my $elem = SOAP::Data->type('data' => $data);
my $response = $CUCM->selectCmDevice($state,$elem);
##my $status=$response->valueof('//return/row/Status');
##print "status is : $status\n\n";
open OUT,'>','soap.xml' or die "$!";
print OUT $response;
close OUT;
Also, I was building an envelope for a different version of CUCM than I have, please see below for the right format. I see that the elements have attributes, do I need to include those in my message? If so, how is this achieved? I know for sure there should be an attribute to the CmSelection Criteria, this is a session Id. Can you please help me include that in my code?
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envel
+ope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:SelectCmDevice soapenv:encodingStyle="http://schemas.xmlsoap.org
+/soap/encoding/"
xmlns:ns1="http://schemas.cisco.com/ast/soap/">
<StateInfo xsi:type="xsd:string"/>
<CmSelectionCriteria href="#id0"/>
</ns1:SelectCmDevice>
<multiRef id="id0" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns2:CmSelectionCriteria"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2="http://schemas.cisco.com/ast/soap/">
<MaxReturnedDevices xsi:type="xsd:unsignedInt">200</MaxReturnedDevice
+s>
<Class xsi:type="xsd:string">Any</Class>
<Model xsi:type="xsd:unsignedInt">255</Model>
<Status xsi:type="xsd:string">Registered</Status>
<NodeName xsi:type="xsd:string" xsi:nil="true"/>
<SelectBy xsi:type="xsd:string">Name</SelectBy>
<SelectItems soapenc:arrayType="ns2:SelectItem[1]" xsi:type="soapenc:
+Array">
<item href="#id1"/>
</SelectItems>
</multiRef>
<multiRef id="id1" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns3:SelectItem" xmlns:ns3="http://schemas.cisco.com/ast/soap
+/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<Item xsi:type="xsd:string">*</Item>
</multiRef>
</soapenv:Body>
</soapenv:Envelope>
|