Software Developer�s Guide for the Cisco Secure Access Control System 5.5
Using the Monitoring and Report Viewer Web Services
Downloads: This chapterpdf (PDF - 314.0KB) The complete bookPDF (PDF - 1.34MB) | Feedback

Table Of Contents

Using the Monitoring and Report Viewer Web Services

Understanding the Methods in the Viewer Web Services

Get Version

Get Authentication Status By Date

Get Authentication Status By Time Unit

Get Failure Reasons

Get RADIUS Accounting

Get API Version

Understanding the WSDL Files

Downloading the WSDL Files

Viewer WSDL Files

Integrating the Viewer Web Services with Your Application

Working with the Viewer Web Services

Required Files

Supported SOAP Clients

Connecting to the Viewer Web Services

Sample Client Code


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.5. 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.5/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.5/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

Understanding the WSDL Files

Integrating the Viewer Web Services with Your Application

Working with the Viewer Web Services

Understanding the Methods in the Viewer Web Services

This section describes the methods that are available in the Viewer web services:

Get Version

Get Authentication Status By Date

Get Authentication Status By Time Unit

Get Failure Reasons

Get RADIUS Accounting

Get API Version

Table 3-1 describes the classes that are used in the Viewer web services.

Table 3-1 Viewer Web Services Class Information

Class
Description

ACSViewWebServices

Contains all web services that a client views in the client applications.

UserContext

Contains the ACS username and the user password, which the Monitoring and Report Viewer server uses to authenticate the user.

AuthenticationParam

Encapsulates the authentication query parameters, based on which records are queried and returned to you.

AuthenticationStatus

Contains the Authentication Status record that is the query output received from ACS.

AccountingParam

Encapsulates the accounting query parameters, based on which records are queried and returned to you.

AccountingStatus

Contains the Accounting Status record that is the query output received from ACS.

AccountingDetail

Contains a list of attribute values that comprise the query output received from ACS.

ACSViewNBException

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

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

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.

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

Viewer WSDL Files

Integrating the Viewer Web Services with Your Application

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">
    <sequence>
     <element name="userCtx" nillable="true" type="tns:UserContext"/>
    </sequence>
   </complexType>
   <complexType name="getAuthenticationStatusByDate">
    <sequence>
     <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"/>
    </sequence>
   </complexType>
   <complexType name="getAuthenticationStatusByDateResponse">
    <sequence>
     <element maxOccurs="unbounded" minOccurs="0" name="result" nillable="true" 
type="tns:AuthenticationStatus"/>
    </sequence>
   </complexType>
   <complexType name="getAuthenticationStatusByTimeUnit">
    <sequence>
     <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"/>
    </sequence>
   </complexType>
   <complexType name="getVersion">
    <sequence>
     <element name="userCtx" nillable="true" type="tns:UserContext"/>
    </sequence>
   </complexType>
   <complexType name="ACSViewNBException">
    <sequence>
     <element name="message" nillable="true" type="string"/>
    </sequence>
   </complexType>
   <complexType name="FailureReason">
    <sequence>
     <element name="authenFailureCode" nillable="true" type="string"/>
     <element name="possibleRootCause" nillable="true" type="string"/>
     <element name="resolution" nillable="true" type="string"/>
    </sequence>
   </complexType>
   <complexType name="AuthenticationParam">
    <sequence>
     <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"/>
    </sequence>
   </complexType>
   <complexType name="AuthenticationStatus">
    <sequence>
     <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"/>
    </sequence>
   </complexType>
   <complexType name="getAuthenticationStatusByTimeUnitResponse">
    <sequence>
     <element maxOccurs="unbounded" minOccurs="0" name="result" nillable="true" 
type="tns:AuthenticationStatus"/>
    </sequence>
   </complexType>
   <complexType name="getVersionResponse">
    <sequence>
     <element name="result" nillable="true" type="string"/>
    </sequence>
   </complexType>
   <complexType name="getFailureReasonsResponse">
    <sequence>
     <element maxOccurs="unbounded" minOccurs="0" name="result" nillable="true" 
type="tns:FailureReason"/>
    </sequence>
   </complexType>
   <complexType name="UserContext">
    <sequence>
     <element name="password" nillable="true" type="string"/>
     <element name="userName" nillable="true" type="string"/>
    </sequence>
   </complexType>
   <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"/>
   <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">
    <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

For more information on the web services, see Understanding the Methods in the Viewer Web Services.

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:

keytool -import -file server.cer -keystore client.ks

Step 2 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.

Step 3 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.

Step 4 Download the JAX-WS 2.0 libraries from the Sun Microsystems website.

Step 5 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.

Step 6 Write the client code.

Step 7 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

Supported SOAP Clients

Sample Client Code

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 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.

Step 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.

Step 3 Save the source information with the name ACSViewWebServices.wsdl on your local directory; <SERVICE_HOME>.

Step 4 Execute the following command to create the class files:

    wsimport <SERVICE_HOME>/ACSViewWebServices.wsdl -d <SERVICE_HOME>
 
 
 
 

Step 5 Copy the "Sample Client Code" section 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.

Step 6 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
}
 
 
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.5");
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
*/
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));
}
 
 
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();
}
}
 
 
/**
** 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");
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();
}
}
}