03-08-2017 10:21 PM
All,
I feel that I am really close, but I am not able to retrieve a phone's status via the selectCmDevice Operation of the RisPort SOAP Service.
Here is my perl Code:
#!/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/RisPort"); ###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;
The error I receive is as follows:
<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server.userException</faultcode><faultstring>org.xml.sax.SAXException: Invalid element in com.cisco.ccm.serviceability.soap.risport.CmSelectionCriteria - DeviceClass</faultstring><detail><ns1:stackTrace xmlns:ns1="http://xml.apache.org/axis/">org.xml.sax.SAXException: Invalid element in com.cisco.ccm.serviceability.soap.risport.CmSelectionCriteria - DeviceClass
at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:258)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:81)
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at sun.reflect.GeneratedMethodAccessor195.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:269)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:301)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:283)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:56)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:189)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555)
at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:394)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)
</ns1:stackTrace><ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">rudua-cucmp001</ns2:hostname></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
Something tells me that the error may be around the <SelectItems> tag because I am not sure that the child structure is adequate. I am also unsure that the URI, and proxy were constructed properly, lastly, I know that a sequence # is needed, I am unsure of how to include that as part of the request.
03-09-2017 09:15 AM
Hi Adan,
I'm not familiar with Perl's SOAP services and libraries. Can you post the actual XML you're trying to send as a request?
One thing you can do is download SoapUI (https://www.soapui.org/) and try your request that way. Once you know your XML request works, then you only have to figure out how to make Perl do it.
03-09-2017 09:30 AM
@Nicholas Petreley
Thanks for your response! Here is my envelope. As constructed by SOAP::Lite. I'll check your software recommendation.
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<selectCmDevice xmlns="http://schemas.cisco.com/ast/soap/action/#RisPort#selectCmDevice">
<StateInfo />
<CmSelectionCriteria>
<SelectBy>Name</SelectBy>
<Status>Any</Status>
<SelectItems>
<item>
<Item>SEPE8BA70FB8CB5</Item>
</item>
</SelectItems>
<Protocol>Any</Protocol>
<NodeName />
<MaxReturnedDevices>200</MaxReturnedDevices>
<Model>255</Model>
<DownloadStatus>Any</DownloadStatus>
<DeviceClass>Any</DeviceClass>
</CmSelectionCriteria>
</selectCmDevice>
</soap:Body>
</soap:Envelope>
03-14-2017 09:56 AM
The below request works on my 10.5 system. Note the change in the xmlns for ast/soap, and the re-ordering of the selection criteria elements:
<soap:Envelope
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns1="http://schemas.cisco.com/ast/soap">
<soap:Body>
<ns1:selectCmDevice>
<ns1:StateInfo/>
<ns1:CmSelectionCriteria>
<ns1:MaxReturnedDevices>200</ns1:MaxReturnedDevices>
<ns1:DeviceClass>Any</ns1:DeviceClass>
<ns1:Model>255</ns1:Model>
<ns1:Status>Any</ns1:Status>
<ns1:NodeName />
<ns1:SelectBy>Name</ns1:SelectBy>
<ns1:SelectItems>
<ns1:item>
<ns1:Item>SEPE8BA70FB8CB5</ns1:Item>
</ns1:item>
</ns1:SelectItems>
<ns1:Protocol>Any</ns1:Protocol>
<ns1:DownloadStatus>Any</ns1:DownloadStatus>
</ns1:CmSelectionCriteria>
</ns1:selectCmDevice>
</soap:Body>
</soap:Envelope>
03-17-2017 12:14 PM
Thank you dstaudt,
I am still struggling to get this going. Can you please clarify a few things for me? What should my URI be? Do I need to include a session ID in my message? If so, where? I am just trying to pull one device at a time. All I want is the device status.
Regards,
Adan Zuniga | Associate Network/VoIP Engineer | IT Infrastructure
Rush University Medical Center | Triangle Office Building
T: 312.942.0078 | E: Adan_Zuniga@rush.edu<mailto:adan_zuniga@rush.edu>
03-22-2017 12:43 PM
The request should be POSTed to https://<server>:8443/realtimeservice2/services/RISService70
No session ID is needed for RisPort - authentication is handled via HTTP Basic auth. The request should look much like my example above.
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: