Using the Monitoring and Report Viewer Web Services



Similar documents
Software Developer s Guide for the Cisco Secure Access Control System 5.1

Onset Computer Corporation

HOBOlink Web Services V2 Developer s Guide

Overview of Web Services API

Introduction to HP ArcSight ESM Web Services APIs

Capario B2B EDI Transaction Connection. Technical Specification for B2B Clients

Configuring Secure Socket Layer (SSL) for use with BPM 7.5.x

bbc Developing Service Providers Adobe Flash Media Rights Management Server November 2008 Version 1.5

European Access Point for Truck Parking Data

Configure a SOAScheduler for a composite in SOA Suite 11g. By Robert Baumgartner, Senior Solution Architect ORACLE

EMC Documentum Composer

SETTING UP YOUR JAVA DEVELOPER ENVIRONMENT

Oracle Web Service Manager 11g Field level Encryption (in SOA, WLS) March, 2012

Oracle WebLogic Server

Cisco BTS Softswitch SOAP Adapter Interface Specification Programmer s Guide, Release 7.0

RPC over XML. Web services with Java. How to install it? Reference implementation. Setting the environment variables. Preparing the system

SSL Certificate Generation

Application Notes for Packaging and Deploying Avaya Communications Process Manager Sample SDK Web Application on a JBoss Application Server Issue 1.

IBM Tivoli Workload Scheduler Integration Workbench V8.6.: How to customize your automation environment by creating a custom Job Type plug-in

Module 13 Implementing Java EE Web Services with JAX-WS

Installing Digital Certificates for Server Authentication SSL on. BEA WebLogic 8.1

Configuring TLS Security for Cloudera Manager

Java Web Services SDK

Java Software Development Kit (JDK 5.0 Update 14) Installation Step by Step Instructions

DEVELOPING CONTRACT - DRIVEN WEB SERVICES USING JDEVELOPER. The purpose of this tutorial is to develop a java web service using a top-down approach.

IBM SPSS Collaboration and Deployment Services Version 6 Release 0. Single Sign-On Services Developer's Guide

SDK Code Examples Version 2.4.2

INTRODUCTION: SQL SERVER ACCESS / LOGIN ACCOUNT INFO:

WIRIS quizzes web services Getting started with PHP and Java

OTN Developer Day: Oracle Big Data. Hands On Lab Manual. Introduction to Oracle NoSQL Database

RHEV 2.2: REST API INSTALLATION

Consuming and Producing Web Services with WST and JST. Christopher M. Judd. President/Consultant Judd Solutions, LLC

Oracle WebLogic Server

Implementing SQI via SOAP Web-Services

Architecting the Future of Big Data

User Migration Tool. Note. Staging Guide for Cisco Unified ICM/Contact Center Enterprise & Hosted Release 9.0(1) 1

CHAPTER 7 SSL CONFIGURATION AND TESTING

How to consume a Domino Web Services from Visual Studio under Security

Working With Derby. Version 10.2 Derby Document build: December 11, 2006, 7:06:09 AM (PST)

Hello World RESTful web service tutorial

Creating and Installing a Self Signed Certificate for PEAP/EAP-TLS Authentication

Custom Encryption in Siebel & Siebel Web Service Security Test Guide 1.0

Implementing a Web Service Client using Java

How to Implement Transport Layer Security in PowerCenter Web Services

Digital Signature Web Service Interface

CRM Migration Manager for Microsoft Dynamics CRM. User Guide

FTP, IIS, and Firewall Reference and Troubleshooting

Web Services API Developer Guide

Iowa Immunization Registry Information System (IRIS) Web Services Data Exchange Setup. Version 1.1 Last Updated: April 14, 2014

CONTRACT MODEL IPONZ DESIGN SERVICE VERSION 2. Author: Foster Moore Date: 20 September 2011 Document Version: 1.7

Consuming, Providing & Publishing WS

Building Web Services with Apache Axis2

Accessing PostgreSQL through JDBC via a Java SSL tunnel

JAVA API FOR XML WEB SERVICES (JAX-WS)

KC Data Integration Web Service Developer Guide

Directories Web Services

PHP Integration Kit. Version User Guide

Web Services ( )

Revision Action/Change Date. A Sentinel Cloud 3.0 Release December 2012 B Sentinel Cloud 3.1 Release April 2013 C

NetIQ Access Manager. Developer Kit 3.2. May 2012

IBM WebSphere Adapter for PeopleSoft Enterprise Quick Start Tutorials

LAB 1. Familiarization of Rational Rose Environment And UML for small Java Application Development

SafeNet KMIP and Amazon S3 Integration Guide

IBM Rational Rapid Developer Components & Web Services

NetBeans IDE Field Guide

Java Access to Oracle CRM On Demand. By: Joerg Wallmueller Melbourne, Australia

FortiGate RADIUS Single Sign-On (RSSO) with Windows Server 2008 Network Policy Server (NPS) VERSION 5.2.3

RSA SecurID Ready Implementation Guide

How To Use Blackberry Web Services On A Blackberry Device

Novell Identity Manager

Connecting Custom Services to the YAWL Engine. Beta 7 Release

Tracking Network Changes Using Change Audit

ADF Code Corner. 92. Caching ADF Web Service results for in-memory filtering. Abstract: twitter.com/adfcodecorner

TIBCO ActiveMatrix Management Agent for WCF Samples. Software Release July 2009

Improved Credential and SSL Configuration for EE 7

Java Client Side Application Basics: Decompiling, Recompiling and Signing

Zebra and MapReduce. Table of contents. 1 Overview Hadoop MapReduce APIs Zebra MapReduce APIs Zebra MapReduce Examples...

WebSphere Business Monitor V7.0: Clustering Single cluster deployment environment pattern

CIMHT_006 How to Configure the Database Logger Proficy HMI/SCADA CIMPLICITY

Basic Exchange Setup Guide

Developer's Guide: Driving Tivoli Workload Automation

Copy the.jar file into the plugins/ subfolder of your Eclipse installation. (e.g., C:\Program Files\Eclipse\plugins)

CommandCenter Secure Gateway

[1]Oracle Communications Billing and Revenue Management Web Services Manager Release 7.5 E

FileMaker Server 10 Help

Amazon Glacier. Developer Guide API Version

Introduction to the EIS Guide

Brekeke PBX Web Service

HP Operations Orchestration Software

An Application Package Configuration Approach to Mitigating Android SSL Vulnerabilities

IBM WebSphere Application Server Version 7.0

Creating a Java application using Perfect Developer and the Java Develo...

Installing Management Applications on VNX for File

Introduction to Mobile Access Gateway Installation

Managing Identities and Admin Access

Hadoop Integration Guide

Wildcard Certificates

Installation and Configuration Guide

Transcription:

CHAPTER 3 Using the Monitoring and Report Viewer Web Services This chapter describes the environment that you must set up to use the web services provided by the Monitoring and Report Viewer component of ACS 5.4. Hereafter this is referred to as Viewer web services. You can use these web services to create custom applications for tracking and troubleshooting ACS events. The Viewer web services comprise the following methods: getversion() Returns the version of the Monitoring and Report Viewer server. getauthenticationstatusbydate() Returns the authentication status of a user by date. getauthenticationstatusbytimeunit() Returns the authentication status of a user by time. getfailurereasons() Returns a list of reasons for failure. getradiusaccounting() Returns a list of RADIUS accounting records. getapiversion() Returns the version of the Viewer web services. Enabling the Web Interface on ACS CLI You must enable the web interface on ACS before you can use the Viewer web services. To enable the web interface on ACS, from the ACS CLI, enter: acs config web-interface view enable For more information on the acs config web-interface command, refer to http://www.cisco.com/en/us/docs/net_mgmt/cisco_secure_access_control_system/5.4/command/ reference/cli_app_a.html#wp1887278. Viewing the Status of the Web Interface from ACS CLI To view the status of the web interface, from the ACS CLI, enter: show acs-config-web-interface For more information on the show acs-config-web-interface command, refer to http://www.cisco.com/en/us/docs/net_mgmt/cisco_secure_access_control_system/5.4/command/ reference/cli_app_a.html#wp1890877. The following sections describe how to use the Monitoring and Report Viewer web services: Understanding the Methods in the Viewer Web Services, page 3-2 Understanding the WSDL Files, page 3-5 3-1

Understanding the Methods in the Viewer Web Services Chapter 3 Integrating the Viewer Web Services with Your Application, page 3-9 Working with the Viewer Web Services, page 3-10 Understanding the Methods in the Viewer Web Services This section describes the methods that are available in the Viewer web services: Get Version, page 3-2 Get Authentication Status By Date, page 3-3 Get Authentication Status By Time Unit, page 3-3 Get Failure Reasons, page 3-4 Get RADIUS Accounting, page 3-4 Get API Version, page 3-5 Table 3-1 describes the classes that are used in the Viewer web services. Table 3-1 Viewer Web Services Class Information Class ACSViewWebServices UserContext AuthenticationParam AuthenticationStatus AccountingParam AccountingStatus AccountingDetail ACSViewNBException Description Contains all web services that a client views in the client applications. Contains the ACS username and the user password, which the Monitoring and Report Viewer server uses to authenticate the user. Encapsulates the authentication query parameters, based on which records are queried and returned to you. Contains the Authentication Status record that is the query output received from ACS. Encapsulates the accounting query parameters, based on which records are queried and returned to you. Contains the Accounting Status record that is the query output received from ACS. Contains a list of attribute values that comprise the query output received from ACS. Contains the errors that the Monitoring and Report Viewer displays for any issues with the web services. Note The Monitoring and Report Viewer places all web service classes in the com.cisco.acsview.nbapi package. Get Version Input Parameter userctx (Required) User context object 3-2

Chapter 3 Understanding the Methods in the Viewer Web Services Purpose Use the getversion method to view the version of the Monitoring and Report Viewer that is installed on your ACS server. You can enter this command in the CLI to call this web service to view the Monitoring and Report Viewer version. Output Parameters Version of the Monitoring and Report Viewer server. Exception This method displays an error if: The user is invalid The input is invalid The ACS instance is not running as the Monitoring and Report Viewer server Get Authentication Status By Date Input Parameters userctx (Required) User context object authparam (Required) AuthenticationParam object startdate (Required) The date from which you want the authentication status enddate (Required) The date until which you want the authentication status Purpose Use the getauthenticationstatusbydate method to view a user s authentication status, arranged chronologically by date, for a specific period. Output Parameter Authentication status of the user, arranged chronologically by date, for the specified period. Exception This method displays an error if the: User context value is entered but passed as null Username and password are entered but passed as null Date value is entered but passed as null Get Authentication Status By Time Unit Input Parameters userctx (Required) User context object authparam (Required) AuthenticationParam object lastx (Required) The time until which you need the authentication status timeunit (Required) Time unit, specified in minutes, hours, or days 3-3

Understanding the Methods in the Viewer Web Services Chapter 3 Purpose Use the getauthenticationstatusbytimeunit method to view a user s authentication status, arranged chronologically by time, for a specific period. Output Parameter A list of the user s authentication status, arranged chronologically by time, for a specific period. Exception This method displays an error if the: User context value is entered but passed as null Username and password are entered but passed as null Date value is entered but passed as null Get Failure Reasons Input Parameter userctx (Required) User context object Purpose Use the getfailurereasons method to obtain a list of records that contain failure reasons. Output Parameters List of records that contain failure reasons. Exception This method displays an error if the user credentials are invalid. Get RADIUS Accounting Input Parameters userctx (Required) User context object acctparam (Required) Accounting search parameters; valid values for matchoperator are valuelike, valueeq, valuene, valuege, valuele, valuegt, valuelt, attreq, valuein, valueinnot. The equation takes any one of the following forms: AttributeName, MatchArgument, MatchOp=[ valuelike valueeq valuene valuege valuele valuegt valuelt attreq] AttributeName, MultipleValueMatchArgument, MatchOp=[ valuein valueinnot ] Attribute Name As defined by standard RADIUS/Cisco A-V pair names. Attribute names are not case sensitive. However, the values are case sensitive. valuelike Looks for wildcard match (%). For example, %foo%. valueeq Looks for an exact match. valuene Performs a value not equal to comparison. valuege Performs greater than or equal to comparison. 3-4

Chapter 3 Understanding the WSDL Files valuele Performs lesser than or equal to comparison. valuegt Performs a greater than comparison. valuelt Performs a lesser than comparison. attreq Compares a given attribute with another attribute; returns true or false. valuein Multiple values are allowed for matchoperator valuein. valueinnot Multiple values are not allowed for matchoperator valueinnot. returnattributes (Required) List of return attributes requested. startdate (Required) Date from which you want the RADIUS accounting records. enddate (Required) Date until which you want the RADIUS accounting records. Purpose Use the getradiusaccounting method to obtain a list of RADIUS accounting records. Output Parameters List of RADIUS accounting records. Exception This method displays an error if: User credentials are invalid The acctparam parameter contains invalid values for matchoperator The acctparam parameter contains invalid value for matchvalues A database select error occurs Get API Version Input Parameter userctx (Required) User context object Purpose Use the getapiversion method to obtain the version of the Viewer web services. Output Parameter Version of the Viewer web services. Exception This method displays an error if an authentication failure occurs. Understanding the WSDL Files This section describes the WSDL files, the location from which you can download them, the class files, and the queries that you can use in the Viewer web services. This section contains the following: Downloading the WSDL Files, page 3-6 3-5

Understanding the WSDL Files Chapter 3 Viewer WSDL Files, page 3-6 Integrating the Viewer Web Services with Your Application, page 3-9 Downloading the WSDL Files You can download the WSDL files from the following location: https://ip address or hostname/acsviewwebservices/acsviewwebservices?wsdl, where ip address or hostname is the IP address or hostname of your ACS server. Viewer WSDL Files WSDL is an XML document that describes a web service, the location of the service, and operations that the service exposes: <definitions name="acsviewwebservicesservice" targetnamespace="http://nbapi.acsview.cisco.com/jaws" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://nbapi.acsview.cisco.com/jaws" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <types> <schema elementformdefault="qualified" targetnamespace="http://nbapi.acsview.cisco.com/jaws" xmlns="http://www.w3.org/2001/xmlschema" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://nbapi.acsview.cisco.com/jaws" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <complextype name="getfailurereasons"> <element name="userctx" nillable="true" type="tns:usercontext"/> <complextype name="getauthenticationstatusbydate"> <element name="userctx" nillable="true" type="tns:usercontext"/> <element name="authparam" nillable="true" type="tns:authenticationparam"/> <element name="startdate" nillable="true" type="datetime"/> <element name="enddate" nillable="true" type="datetime"/> <complextype name="getauthenticationstatusbydateresponse"> <element maxoccurs="unbounded" minoccurs="0" name="result" nillable="true" type="tns:authenticationstatus"/> <complextype name="getauthenticationstatusbytimeunit"> <element name="userctx" nillable="true" type="tns:usercontext"/> <element name="authparam1" nillable="true" type="tns:authenticationparam"/> <element name="lastx" type="int"/> <element name="timeunit" nillable="true" type="string"/> <complextype name="getversion"> <element name="userctx" nillable="true" type="tns:usercontext"/> 3-6

Chapter 3 Understanding the WSDL Files <complextype name="acsviewnbexception"> <element name="message" nillable="true" type="string"/> <complextype name="failurereason"> <element name="authenfailurecode" nillable="true" type="string"/> <element name="possiblerootcause" nillable="true" type="string"/> <element name="resolution" nillable="true" type="string"/> <complextype name="authenticationparam"> <element name="aaaclient" nillable="true" type="string"/> <element name="clientipaddress" nillable="true" type="string"/> <element name="clientmacaddress" nillable="true" type="string"/> <element name="username" nillable="true" type="string"/> <complextype name="authenticationstatus"> <element name="authstatus" nillable="true" type="string"/> <element name="date" nillable="true" type="datetime"/> <element name="errorcode" nillable="true" type="string"/> <element maxoccurs="unbounded" minoccurs="0" name="moredetails" nillable="true" type="string"/> <complextype name="getauthenticationstatusbytimeunitresponse"> <element maxoccurs="unbounded" minoccurs="0" name="result" nillable="true" type="tns:authenticationstatus"/> <complextype name="getversionresponse"> <element name="result" nillable="true" type="string"/> <complextype name="getfailurereasonsresponse"> <element maxoccurs="unbounded" minoccurs="0" name="result" nillable="true" type="tns:failurereason"/> <complextype name="usercontext"> <element name="password" nillable="true" type="string"/> <element name="username" nillable="true" type="string"/> <element name="getauthenticationstatusbydate" type="tns:getauthenticationstatusbydate"/> <element name="getauthenticationstatusbydateresponse" type="tns:getauthenticationstatusbydateresponse"/> <element name="getauthenticationstatusbytimeunit" type="tns:getauthenticationstatusbytimeunit"/> <element name="getauthenticationstatusbytimeunitresponse" type="tns:getauthenticationstatusbytimeunitresponse"/> <element name="getversion" type="tns:getversion"/> <element name="acsviewnbexception" type="tns:acsviewnbexception"/> <element name="getversionresponse" type="tns:getversionresponse"/> 3-7

Understanding the WSDL Files Chapter 3 <element name="getfailurereasons" type="tns:getfailurereasons"/> <element name="getfailurereasonsresponse" type="tns:getfailurereasonsresponse"/> </schema> </types> <message name="acsviewnbexception"> <part element="tns:acsviewnbexception" name="acsviewnbexception"/> </message> <message name="acsviewwebservices_getauthenticationstatusbydate"> <part element="tns:getauthenticationstatusbydate" name="parameters"/> </message> <message name="acsviewwebservices_getauthenticationstatusbytimeunitresponse"> <part element="tns:getauthenticationstatusbytimeunitresponse" name="result"/> </message> <message name="acsviewwebservices_getauthenticationstatusbydateresponse"> <part element="tns:getauthenticationstatusbydateresponse" name="result"/> </message> <message name="acsviewwebservices_getversionresponse"> <part element="tns:getversionresponse" name="result"/> </message> <message name="acsviewwebservices_getauthenticationstatusbytimeunit"> <part element="tns:getauthenticationstatusbytimeunit" name="parameters"/> </message> <message name="acsviewwebservices_getversion"> <part element="tns:getversion" name="parameters"/> </message> <message name="acsviewwebservices_getfailurereasons"> <part element="tns:getfailurereasons" name="parameters"/> </message> <message name="acsviewwebservices_getfailurereasonsresponse"> <part element="tns:getfailurereasonsresponse" name="result"/> </message> <porttype name="acsviewwebservices"> <operation name="getauthenticationstatusbydate"> <input message="tns:acsviewwebservices_getauthenticationstatusbydate"/> <output message="tns:acsviewwebservices_getauthenticationstatusbydateresponse"/> <fault message="tns:acsviewnbexception" name="acsviewnbexception"/> </operation> <operation name="getauthenticationstatusbytimeunit"> <input message="tns:acsviewwebservices_getauthenticationstatusbytimeunit"/> <output message="tns:acsviewwebservices_getauthenticationstatusbytimeunitresponse"/> <fault message="tns:acsviewnbexception" name="acsviewnbexception"/> </operation> <operation name="getversion"> <input message="tns:acsviewwebservices_getversion"/> <output message="tns:acsviewwebservices_getversionresponse"/> <fault message="tns:acsviewnbexception" name="acsviewnbexception"/> </operation> <operation name="getfailurereasons"> <input message="tns:acsviewwebservices_getfailurereasons"/> <output message="tns:acsviewwebservices_getfailurereasonsresponse"/> <fault message="tns:acsviewnbexception" name="acsviewnbexception"/> </operation> </porttype> <binding name="acsviewwebservicesbinding" type="tns:acsviewwebservices"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="getauthenticationstatusbydate"> <soap:operation soapaction=""/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> <fault name="acsviewnbexception"> 3-8

Chapter 3 Understanding the WSDL Files <soap:fault name="acsviewnbexception" use="literal"/> </fault> </operation> <operation name="getauthenticationstatusbytimeunit"> <soap:operation soapaction=""/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> <fault name="acsviewnbexception"> <soap:fault name="acsviewnbexception" use="literal"/> </fault> </operation> <operation name="getversion"> <soap:operation soapaction=""/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> <fault name="acsviewnbexception"> <soap:fault name="acsviewnbexception" use="literal"/> </fault> </operation> <operation name="getfailurereasons"> <soap:operation soapaction=""/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> <fault name="acsviewnbexception"> <soap:fault name="acsviewnbexception" use="literal"/> </fault> </operation> </binding> <service name="acsviewwebservicesservice"> <port binding="tns:acsviewwebservicesbinding" name="acsviewwebservices"> <soap:address location="http://localhost:8080/acsviewwebservices/acsviewwebservices"/> </port> </service> </definitions> Integrating the Viewer Web Services with Your Application This section explains how to integrate the Viewer web services with your application. To integrate your code with a Viewer web service and to ensure that you get a response after you invoke the web service: Step 1 Obtain the certificate from the server to create the client certificate: a. Verify the deployed web services from: https://ip address or hostname/acsviewwebservices/acsviewwebservices?wsdl 3-9

Working with the Viewer Web Services Chapter 3 For more information on the web services, see Understanding the Methods in the Viewer Web Services, page 3-2. b. Click View Certificate and go to the Details tab. c. Click Copy to File. d. In the welcome window, click Next. e. In the Export File Format window, select DER encoded binary X.509(.CER), then click Next. f. In the File to Export window, enter the filename and click Next. g. In the Completing the Certificate Export Wizard window, click Finish. A copy of the certificate is saved in your local system as server.cer. h. Import the server certificate and store it as client.ks (the Client Certificate) using the following command: Step 2 Step 3 Step 4 Step 5 Step 6 Step 7 keytool -import -file server.cer -keystore client.ks Verify the deployed Viewer web services from: https://ipaddress(or)hostname/acsviewwebservices/acsviewwebservices?wsdl For more information on the web services, see Understanding the Methods in the Viewer Web Services, page 3-2. View the source and copy the WSDL file to your local system using: soap:address location='https://acsview-cars1:443/acsviewwebservices/acsviewwebservices'/ For more information on the WSDL files, see Understanding the WSDL Files, page 3-5. Download the JAX-WS 2.0 libraries from the Sun Microsystems website. To view the information related to your artifacts, enter the wsimport -keep command at: https://ipaddress:443/acsviewwebserv/acsviewwebservices?wsdl Include all the libraries in your location. Write the client code. Compile and run the client code. Working with the Viewer Web Services This section provides sample client code in Java. The requirements that this section describes apply only if you use Java as the client-side conversion tool. This section contains: Required Files, page 3-11 Supported SOAP Clients, page 3-11 Sample Client Code, page 3-12 3-10

Chapter 3 Working with the Viewer Web Services Required Files To use Java (JAX-WS) 2.0 as the client-side conversion tool, you need the following JAR files. You can download the.jar files and the related tools from the Sun Microsystems website: activation.jar FastInfoset.jar http.jar jaxb-api.jar jaxb-impl.jar jaxb-xjc.jar jaxws-api.jar jaxws-rt.jar jaxws-tools.jar jsr173_api.jar jsr181-api.jar jsr250-api.jar resolver.jar saaj-api.jar saaj-impl.jar sjsxp.jar Supported SOAP Clients The supported SOAP clients include: Apache JAX-WS Connecting to the Viewer Web Services To connect to the Viewer Web Services: Step 1 Step 2 Step 3 Verify the deployed Viewer Web Services from: https://ip address or hostname/acsviewwebservices/acsviewwebservices?wsdl For more information on the web services, see Understanding the Methods in the Viewer Web Services, page 3-2. Right click and select View Source/View Page Source option to view the source information. The source information appears in a pop-up dialog box. Save the source information with the name ACSViewWebServices.wsdl on your local directory; <SERVICE_HOME>. 3-11

Working with the Viewer Web Services Chapter 3 Step 4 Execute the following command to create the class files: wsimport <SERVICE_HOME>/ACSViewWebServices.wsdl -d <SERVICE_HOME> Step 5 Step 6 Copy the Sample Client Code section on page 3-12 and save it as Client.java in <SERVICE_HOME> and compile it with the following command javac -cp <SERVICE_HOME> <SERVICE_HOME>/Client.java -d <SERVICE_HOME> This compiles the client code and places the package in the <SERVICE_HOME> directory. To run the Client code, execute the following command java -cp <SERVICE_HOME> com.cisco.acsview.nbapi.jaws.client. Note The above mentioned steps are done in Java 1.6.0_25. JAVA_HOME is java installed directory, and the "path" environment variable should be added with the value <JAVA_HOME>/bin. Sample Client Code This section provides sample client code for the Viewer web services. package com.cisco.acsview.nbapi.jaws; import java.util.calendar; import java.util.gregoriancalendar; import java.util.arraylist; import java.util.list; import java.util.iterator; import com.sun.org.apache.xerces.internal.jaxp.datatype.xmlgregoriancalendarimpl; import javax.xml.datatype.xmlgregoriancalendar; import javax.xml.datatype.datatypefactory; import java.security.cert.x509certificate; import javax.net.ssl.hostnameverifier; import javax.net.ssl.httpsurlconnection; import javax.net.ssl.sslcontext; import javax.net.ssl.sslsession; import javax.net.ssl.trustmanager; import javax.net.ssl.x509trustmanager; public class Client private static void install() throws Exception // Create a trust manager that does not validate certificate chains TrustManager[] trustallcerts = new TrustManager[] new X509TrustManager() public X509Certificate[] getacceptedissuers() return null; public void checkclienttrusted(x509certificate[] certs, String authtype) // Trust always 3-12

Chapter 3 Working with the Viewer Web Services public void checkservertrusted(x509certificate[] certs, String authtype) // Trust always ; // Install the all-trusting trust manager SSLContext sc = SSLContext.getInstance("SSL"); // Create empty HostnameVerifier HostnameVerifier hv = new HostnameVerifier() public boolean verify(string arg0, SSLSession arg1) return true; ; sc.init(null, trustallcerts, new java.security.securerandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); HttpsURLConnection.setDefaultHostnameVerifier(hv); public static void install1() throws Exception // Bypass hostname verification. HttpsURLConnection.setDefaultHostnameVerifier( new HostnameVerifier() public boolean verify(string arg0, SSLSession arg1) return true; ); public static void main(string args[]) try install(); ACSViewWebServicesService serviceobj = new ACSViewWebServicesService(); ACSViewWebServices service = serviceobj.getacsviewwebservices(); UserContext userctx = new UserContext(); userctx.setusername("acsadmin"); userctx.setpassword("acs5.1"); getversion(service,userctx); getapiversion(service,userctx); getauthbydate(service,userctx); getauthbytime(service,userctx); getradiusaccounting(service,userctx); getfailurereasons(service,userctx); catch (Exception ex) ex.printstacktrace(); /** * getversion provide the application version */ 3-13

Working with the Viewer Web Services Chapter 3 public static void getversion(acsviewwebservices service, UserContext userctx) try String result = service.getversion(userctx); System.out.println("-------------------------*** Application Version ***-------------------------"+"\n"); System.out.println("Application Version : "+result); System.out.println("---------------------------------------------------------------------- -------"+"\n"); catch(exception e) e.printstacktrace(); /** *getauthbydate provides the data of the authentication success/failure between the specified date range */ private static void getauthbydate(acsviewwebservices service, UserContext userctx) try System.out.println("-------------------------*** Authentication Status by Date Starts ***-------------------------"+"\n"); AuthenticationParam authparam = new AuthenticationParam(); /** *** The following Attributes are optional. ** If the parameters are not set, method will return all the authentications success/failure between the specified date range. ** The Data will be filtered based on the attribute set which is falling under the specified date range. ** The attributes set are exactly matched for filtering,ie., only the data which is matching the below attributes and with in the specified date range are retrived. */ authparam.setaaaclient("myclient"); authparam.setclientipaddress("10.77.241.203"); authparam.setclientmacaddress("abac00019e05"); authparam.setusername("user1"); /******* Optional Attributes Ends **************/ DatatypeFactory datatypefactory = DatatypeFactory.newInstance(); GregorianCalendar gc1 = newgregoriancalendar(2011, Calendar.AUGUST, 4); XMLGregorianCalendar startdate = datatypefactory.newxmlgregoriancalendar(gc1).normalize(); GregorianCalendar gc2 = newgregoriancalendar(2011, Calendar.AUGUST, 6); XMLGregorianCalendar enddate = datatypefactory.newxmlgregoriancalendar(gc2).normalize(); java.util.list authstatusarray = service.getauthenticationstatusbydate(userctx,authparam, startdate, enddate); System.out.println("No of Records Retrieved : "+authstatusarray.size()); for(int i=0; i<authstatusarray.size();i++) System.out.println("*************** Authentication Status : "+(i+1)+" ***************"); AuthenticationStatus status = (AuthenticationStatus)authStatusArray.get(i); java.util.list sarray = status.getmoredetails(); System.out.println(sarray.get(0) +" :: "+sarray.get(1)); for(int j=0;j<sarray.size();j++) System.out.println(sarray.get(j)+" :: "+sarray.get(++j)); 3-14

Chapter 3 Working with the Viewer Web Services System.out.println("******************************************************************"); System.out.println("-------------------------*** Authentication Status by Date Ends ***-------------------------"+"\n"); catch (Exception ex) ex.printstacktrace(); /** * getauthbytime provides the data of the authentication success/failure in the specified time. * Time can be provided in Minutes, Hours or Days */ private static void getauthbytime(acsviewwebservices service, UserContext userctx) try System.out.println("-------------------------*** Authentication Status by Time Starts ***-------------------------"+"\n"); AuthenticationParam authparam = new AuthenticationParam(); /** *** The following Attributes are optional. ** If the parameters are not set method will return all the authentications success/failure between the specified date range. ** The Data will be filtered based on the attribute set which is falling under the specified date range. ** The attributes set are exactly matched for filtering,ie., only the data which is matching the below attributes and with in the specified date range are retrived. */ authparam.setaaaclient("myclient"); authparam.setclientipaddress("10.77.241.203"); authparam.setclientmacaddress("abac00019e05"); authparam.setusername("user1"); /******* Optional Attributes Ends **************/ java.util.list authstatusarray = service.getauthenticationstatusbytimeunit(userctx,authparam, 20, "Hours"); System.out.println("No of Records Retrieved : " + authstatusarray.size()); for(int i=0; i<authstatusarray.size();i++) System.out.println("*************** Authentication Status : "+(i+1)+" ***************"); AuthenticationStatus status = (AuthenticationStatus)authStatusArray.get(i); java.util.list sarray = status.getmoredetails(); System.out.println(sarray.get(0) +" :: "+sarray.get(1)); for(int j=0;j<sarray.size();j++) System.out.println(sarray.get(j)+" :: "+sarray.get(++j)); System.out.println("******************************************************************"); System.out.println("-------------------------*** Authentication Status by Time Ends ***-------------------------"+"\n"); catch (Exception ex) ex.printstacktrace(); 3-15

Working with the Viewer Web Services Chapter 3 /** ** getapiversion provides the application API Version */ public static void getapiversion(acsviewwebservices service, UserContext userctx) try System.out.println("-------------------------*** API Version ***-------------------------"+"\n"); String apiresult = service.getapiversion(userctx); System.out.println("API Version : "+apiresult); System.out.println("---------------------------------------------------------------------- -------"+"\n"); catch(exception ex) ex.printstacktrace(); /** ** getfailurereasons provide the Failure Code, Possible Root Cause and Resolution */ public static void getfailurereasons(acsviewwebservices service, UserContext userctx) try // Get Failure reason - Example System.out.println("-------------------------*** Failure Reasons Starts ***-------------------------"+"\n"); List result1 = service.getfailurereasons(userctx); System.out.println("Failure reasons list is : " + result1.size()); for (int i=0;i<result1.size() ;i++ ) System.out.println("Authentication Failure Code : "+((FailureReason)result1.get(i)).getAuthenFailureCode()); System.out.println("Possible Root Cause : "+((FailureReason)result1.get(i)).getPossibleRootCause()); System.out.println("Resolution : "+((FailureReason)result1.get(i)).getResolution()); System.out.println("-------------------------*** Failure Reasons Ends ***-------------------------"+"\n"); catch(exception ex) ex.printstacktrace(); /** ** getradiusaccounting provides the accounting details between the specified date range. */ public static void getradiusaccounting(acsviewwebservices service, UserContext userctx) try System.out.println("-------------------------*** Radius Accounting Starts ***-------------------------"+"\n"); 3-16

Chapter 3 Working with the Viewer Web Services List acctparam = new ArrayList(); AccountingParam acparam = new AccountingParam(); List vallist = acparam.getmatchvalues(); vallist.add("11"); acparam.setattributename("cisco-h323-disconnect-cause/h323-disconnect-cause"); acparam.setmatchoperator("valueinnot"); acctparam.add(acparam); List returnattributes = new ArrayList(); returnattributes.add("cisco-h323-disconnect-cause/h323-disconnect-cause"); DatatypeFactory datatypefactory = DatatypeFactory.newInstance(); GregorianCalendar gc1 = newgregoriancalendar(2011, Calendar.AUGUST, 5); XMLGregorianCalendar startdate = datatypefactory.newxmlgregoriancalendar(gc1).normalize(); GregorianCalendar gc2 = newgregoriancalendar(2011, Calendar.AUGUST, 7); XMLGregorianCalendar enddate = datatypefactory.newxmlgregoriancalendar(gc2).normalize(); AccountingStatus acctstatus = service.getradiusaccounting(userctx,acctparam, startdate, enddate, returnattributes); List attrnames = acctstatus.getattrnames(); for(int x=0 ; x<attrnames.size() ; x++) System.out.println("Attribute Names : "+attrnames.get(x)); List acctdetailslist = (ArrayList)acctStatus.getAcctDetails(); Iterator detailiterator = acctdetailslist.iterator(); while(detailiterator.hasnext()) AccountingDetail acctdetailobj = (AccountingDetail)detailIterator.next(); List acctdetails = (List)acctDetailObj.getAttrValues(); for (int i=0;i<acctdetails.size() ;i++ ) System.out.println("Attribute Details : "+acctdetails.get(i)); System.out.println("-------------------------*** Radius Accounting Ends ***-------------------------"+"\n"); catch(exception e) e.printstacktrace(); 3-17

Working with the Viewer Web Services Chapter 3 3-18