cancel
Showing results for 
Search instead for 
Did you mean: 
cancel

Who Me Too'd this topic

Risport retrieval failure - PHP

Andre Castro
Beginner
Beginner

Dear folks,

When trying to fetch device status via RisPort using PHP, I get the following error:

Error the cmSelectionCriteria is null

Interestingly, I have a working version written in python.

Both of them are as below:

PHP:

<body>

<div class="container-fluid">

<?php

include "utils.php";

$client = new SoapClient("rispost.wsdl",

  array('trace'=>true,

   'exceptions'=>true,

   'location'=>"https://".$host.":8443/realtimeservice/services/RisPort",

   'login'=>$username,

   'password'=>$password,

   'connection_timeout'=>60,

   'stream_context' => $context,

   'trace' => 1

));

try

{

  $devices = $client->SelectCmDevice(

     "",

     array(

         "SelectBy" => "Name",

         "Status" => "Registered",

     )

);

}

catch (SoapFault $e)

{

  echo "Cannot call method: {$e->getMessage()}";

}

?>

</div>

</body>

</html>

--

Python:

from suds.client import Client

from suds.xsd.doctor import Import, ImportDoctor

import logging

import Basic

import ssl

ssl._create_default_https_context = ssl._create_unverified_context

wsdl = 'https://172.16.4.200:8443/realtimeservice/services/RisPort?wsdl'

cmport = '8443'

#wsdl = 'http://172.17.1.30/AXLAPI.wsdl'

#location = 'https://' + cmserver + ':' + cmport + '/axl/'

import getpass

user = input('user:')

pwd = getpass.getpass('pwd:')

print ('Loading...')

imp = Import('http://schemas.xmlsoap.org/soap/encoding/')

doctor = ImportDoctor(imp)

print('Loading...\n')

client = Client(url=wsdl, username=user, password=pwd, doctor=doctor)

result = client.service.SelectCmDevice('',{'SelectBy':'Name', 'Status':'Registered', 'Class':'Phone', 'Model':'255'})

print('\tDevice\t\tIP Address\tDescription\n\n')

for node in result['SelectCmDeviceResult']['CmNodes']:

    for device in node['CmDevices']:

        print ('\t'+device['Name'] +'\t'+ device['IpAddress'] +'\t'+ device['Description'])

print('\n\n')

Any ideas?

Regards

Andre Castro

Who Me Too'd this topic