adamZ88 has asked for the wisdom of the Perl Monks concerning the following question:
Monks, I have the following code that is supposed to create a SOAP request like the example that I will provide. The purpose of the code is to query the RISDB of CUCM(Cisco Unified Communications Manager) and get a phone registration status. The problem is that I am not sure that my Request envelope is being constructed like it should, so I want to print the entire request envelope to see it and compare it to what Cisco provides as an example. Can you please help me in printing out my Request envelope? If possible in constructing the envelope to match the example? and finally in printing the entire response because I also do not know how to print just the part that I need. Thanks. The same code works for interfacing the AXL API and doing an SQL query for other information about the phones. I am just now knowing how to construct this request
################################################## #!/usr/bin/perl $cucm_ip = "10.74.7.52"; $user_axl = "user"; $password_axl = "password"; $path_file=$path."input.txt"; ###################################################################### +######################### $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") ->proxy("https://$cucm_ip:8443/realtimeservice2/services/RI +SService70?wsdl"); 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"; ###################################################################### +############################ my $xmlCode = "<selectCmDevice><StateInfo></StateInfo><CmSelectionCrit +eria><MaxReturnedDevices>1000</MaxReturnedDevices><DeviceClass>Any</D +eviceClass><Model>255</Model><Status>Any</Status><NodeName></NodeName +><SelectBy>Name</SelectBy><SelectItems><!--Zero or more repetitions:- +-><item><Item>$devname</Item></item></SelectItems><Protocol>Any</Prot +ocol><DownloadStatus>Any</DownloadStatus></CmSelectionCriteria></sele +ctCmDevice>"; $elem = SOAP::Data->type('xml' => $xmlCode); my $sRes = $CUCM->selectCmDevice($elem); my @devStat = $sRes->valueof('//return/row/Status'); print "Device Status:";print join (',' , @devStat);pr +int "\n"; #print "Device Type:".$_device_pkid."\n"; #print "Device Desc:".$_device_description."\n"; print "---\n"; ###################################################################### +############################### } } else { print "File not found\n"; } ###End################################################################ +#############################
Below is the example that cisco provides https://developer.cisco.com/site/sxml/documents/api-reference/risport/#selectcmdevice-request-format
<!--RisPort70 API - SelectCmDevice - Request--> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envel +ope/" xmlns:soap="http://schemas.cisco.com/ast/soap"> <soapenv:Header/> <soapenv:Body> <soap:selectCmDevice> <soap:StateInfo></soap:StateInfo> <soap:CmSelectionCriteria> <soap:MaxReturnedDevices>1000</soap:MaxReturnedDevices> <soap:DeviceClass>Any</soap:DeviceClass> <soap:Model>255</soap:Model> <soap:Status>Any</soap:Status> <soap:NodeName></soap:NodeName> <soap:SelectBy>DirNumber</soap:SelectBy> <soap:SelectItems> <!--Zero or more repetitions:--> <soap:item> <soap:Item>6961</soap:Item> </soap:item> </soap:SelectItems> <soap:Protocol>Any</soap:Protocol> <soap:DownloadStatus>Any</soap:DownloadStatus> </soap:CmSelectionCriteria> </soap:selectCmDevice> </soapenv:Body> </soapenv:Envelope>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Displaying SOAP Request and Response
by beech (Parson) on Mar 08, 2017 at 07:37 UTC | |
|
Re: Displaying SOAP Request and Response
by poj (Abbot) on Mar 08, 2017 at 13:30 UTC | |
by adamZ88 (Beadle) on Mar 09, 2017 at 06:42 UTC | |
by poj (Abbot) on Mar 09, 2017 at 08:20 UTC | |
by adamZ88 (Beadle) on Mar 09, 2017 at 16:33 UTC | |
by poj (Abbot) on Mar 09, 2017 at 16:56 UTC | |
by adamZ88 (Beadle) on Mar 09, 2017 at 16:37 UTC |