Highlighted
Rabobank NMS Contributor.
Contributor.
301 views

NNMi SOAP API example in PHP

Here is an example of calling the SOAP API of NNMi in PHP.

#!/usr/bin/php
<?php

echo "Password for AdminUser: ";
system('stty -echo');
$pw = rtrim(fgets(STDIN));
system('stty echo');
echo "\n";

$no_verify_ssl = stream_context_create([
               'ssl' => [ 'verify_peer' => false,
               'verify_peer_name'  => false,
               'allow_self_signed' => true]
            ]);

# Connect to the SOAP server
$client = new SoapClient('https://nnmi.example.com/InterfaceBeanService/InterfaceBean?wsdl',
    ['trace' => 1, 'login'=> 'AdminUser', 'password' => $pw
     'stream_context' => $no_verify_ssl ]
 );
if ( !$client ) {
  echo("ERROR: could not connect to SOAP server\n");
  return 1;
}

class condition {
   function condition($name, $op, $val) {
      $this->name = $name;
      $this->operator = $op;
      $this->value = $val;
   }
}

#$condition = new condition('ifName', 'LIKE', 'Gi*');
#$condition = new condition('operationalState', 'EQ', 'UP');
$condition = new condition('ifAlias', 'EQ', '-mgmt-');

$soapcondition = new SoapVar ($condition, SOAP_ENC_OBJECT, "condition", "http://filter.sdk.nms.ov.hp.com/");

#var_dump($client->getInterfaceCount(new SoapParam($soapcondition, "arg0")));

var_dump($client->getInterfaces(new SoapParam($soapcondition, "arg0")));
#echo $client->__getLastRequest();
#var_dump($client->__getFunctions());
?>

Tags (4)
1 Reply
Gabriel
Visitor.

Re: NNMi SOAP API example in PHP

Hi, thak you fro your message.

May we know if there is any issue with that API call with PHP?

What seems to be your goal and what issue/error are you having?

 

Thank you.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.