Cisco Cisco Security Manager 4.11 User Guide

Page of 301
 
 
 
  
 
Cisco Security Manager 4.11 API Specification (Version 2.3) 
 
Page  230
 
9  Sample API Client Programs 
 
NOTE: All the sample programs in this section are provided for simple demonstration 
purposes only. The programs may need to be appropriately enhanced or modified for use 
in production systems.  
 
Running the java sample programs mentioned  below  need the following to be setup: 
1.  The http-client and http-core jars from Apache-commons 
 must be included in the 
java CLASSPATH. 
2.  The commons-logging jar from Apache-commons 
 must be 
included in the java CLASSPATH 
3.  Define a CLASSPATH environment variable in your command shell include all the required jars and other 
folders as necessary 
4.  A client.properties file must be defined and passed in as a parameter as a java program argument. The 
format of the file is as follows: 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
The property definition are as follows: 
 
•  USER: Defines the username of the user logging in. 
•  PASSWORD: The user password 
•  HOST: The host server to connect 
•  XML_REQUEST: The XML request that needs to be sent (ping in this case) 
•  LOGIN_REQUIRED: If true, a login is done before sending the XML_REQUEST. 
•  URI: Optional URI parameter that indicates the service that needs to be invoked. If this is not 
specified in the property file, it must be passed in as a java program argument. 
 
Please note that the property values in the client.properties file like HOST, USER, PASSWORD, other 
values in the XML_REQUEST and the URI itself may need to modified to suit your deployment and the 
sample that is being executed. Edit this file appropriately before executing any of programs mentioned 
below. 
 
9.1 CSM API pre-configuration checks 
 
USER=admin 
PASSWORD=admin 
HOST=localhost 
XML_REQUEST=<?xml version=\"1.0\" encoding=\"UTF-8\"?>\ 
<csm:pingRequest  xmlns:csm=\"csm\">\ 
 
<protVersion>1.0</protVersion>\ 
 
<reqId>3</reqId>\ 
</csm:pingRequest> 
 
# Set LOGIN_REQUIRED to true if the URI supplied  
# requires login to be done as a prerequisite. 
LOGIN_REQUIRED=true 
URI=https://localhost/nbi/ping