Nimsoft Monitor SOAP Web Services Getting Started Guide

Similar documents
CA Nimsoft Service Desk

Nimsoft Monitor Compatibility Matrix October 17, 2013

CA Nimsoft Unified Management Portal

CA Nimsoft Monitor Snap

Unified Infrastructure Management Compatibility Matrix April 4, 2016

CA Nimsoft Monitor. Probe Guide for Active Directory Server. ad_server v1.4 series

CA Nimsoft Monitor. Probe Guide for NT Event Log Monitor. ntevl v3.8 series

CA Nimsoft Monitor. snmpcollector Release Notes. All versions

Nimsoft Monitor. ntevl Guide. v3.6 series

CA Nimsoft Monitor. Probe Guide for CPU, Disk and Memory. cdm v4.7 series

Nimsoft Monitor. sysloggtw Guide. v1.4 series

CA Nimsoft Monitor. Probe Guide for IIS Server Monitoring. iis v1.5 series

CA Nimsoft Service Desk

CA Nimsoft Monitor. snmptd Guide. v3.0 series

Nimsoft Monitor. zones Guide. v1.3 series

Nimsoft Monitor. cmdbgtw Guide. v1.0 series

CA Nimsoft Monitor Snap

Web Enabled Software for 8614xB-series Optical Spectrum Analyzers. Installation Guide

Maven2. Configuration and Build Management. Robert Reiz

Software project management. and. Maven

Hands on exercise for

CA Nimsoft Service Desk

European Access Point for Truck Parking Data

CA Nimsoft Unified Management Portal

CA Nimsoft Service Desk

Agilent OpenLAB. Data Store. Disaster Recovery Plan

CA Nimsoft Monitor. Probe Guide for CA ServiceDesk Gateway. casdgtw v2.4 series

webcrm API Getting Started

CA Nimsoft Monitor. Probe Guide for Microsoft Exchange Server Response Monitoring. ews_response v1.1 series

HP OpenView Patch Manager Using Radia

Nimsoft Monitor. sqlserver Release Notes. All series

CA Nimsoft Monitor. Probe Guide for Performance Collector. perfmon v1.5 series

Sonatype CLM for Maven. Sonatype CLM for Maven

Oracle Enterprise Manager

OpenLDAP Oracle Enterprise Gateway Integration Guide

CA Nimsoft Monitor. Probe Guide for Lotus Notes Server Monitoring. notes_server v1.5 series

Disaster Recovery. Websense Web Security Web Security Gateway. v7.6

HP Project and Portfolio Management Center

WebSphere MQ Oracle Enterprise Gateway Integration Guide

Tutorial: BlackBerry Object API Application Development. Sybase Unwired Platform 2.2 SP04

HP OpenView Adapter for SSL Using Radia

CA Performance Center

CA Clarity PPM. Connector for Microsoft SharePoint Product Guide. Service Pack

CA Unified Infrastructure Management Server

CA Workload Automation Agent for Microsoft SQL Server

WatchDox for Windows User Guide. Version 3.9.0

Symantec Managed PKI. Integration Guide for ActiveSync

Microsoft Active Directory Oracle Enterprise Gateway Integration Guide

BEAWebLogic. Portal. WebLogic Portlets for SAP Installation Guide

Symantec Backup Exec 2010 R2. Quick Installation Guide

CA Technologies SiteMinder

Oracle Enterprise Manager

Installing the SSL Client for Linux

CA Nimsoft Monitor. Probe Guide for Active Directory Response. ad_response v1.6 series

CA Process Automation

TIBCO ActiveMatrix BusinessWorks Plug-in for TIBCO Managed File Transfer Software Installation

HP Asset Manager. Implementing Single Sign On for Asset Manager Web 5.x. Legal Notices Introduction Using AM

CA Spectrum and CA Embedded Entitlements Manager

HP Operations Orchestration Software

CA Spectrum and CA Service Desk

Configuring and Integrating JMX

Nimsoft Monitor. iis Guide. v1.5 series

NetBackup Backup, Archive, and Restore Getting Started Guide

CA Nimsoft Monitor. Probe Guide for Cloud Monitoring Gateway. cuegtw v1.0 series

OfficeConnect Internet Firewall 25 Internet Firewall DMZ. QuickStart Guide (3C16770, 3C16771)

SDK Code Examples Version 2.4.2

USING MICROSOFT ONEDRIVE FOR BUSINESS FOR MAC OS X USER S GUIDE

WHITE PAPER. HP Guide to System Recovery and Restore

AGILEXRM REFERENCE ARCHITECTURE

Omniquad Exchange Archiving

ACT! by Sage. Premium for Workgroups 2007 (9.0) Administrator s Guide to the ACT! Reader Utility

CA Change Manager Enterprise Workbench r12

Connector for CA Unicenter Asset Portfolio Management Product Guide - On Premise. Service Pack

Maven or how to automate java builds, tests and version management with open source tools

Symantec Backup Exec TM 11d for Windows Servers. Quick Installation Guide

VERITAS Backup Exec 9.1 for Windows Servers Quick Installation Guide

CA Nimsoft Monitor. Probe Guide for Java Virtual Machine Monitoring. jvm_monitor v1.4 series

CA Cloud Service Delivery Platform

Synchronization Server SDK Version Release Notes and Known Issues List

CA Workload Automation Agent for Databases

How To Install Caarcserve Backup Patch Manager (Carcserver) On A Pc Or Mac Or Mac (Or Mac)

Build management & Continuous integration. with Maven & Hudson

Customizing Asset Manager for Managed Services Providers (MSP) Software Asset Management

Builder User Guide. Version Visual Rules Suite - Builder. Bosch Software Innovations

Adeptia Suite LDAP Integration Guide

WatchDox for Windows. User Guide. Version 3.9.5

Symantec Indepth for. Technical Note

Resource Online User Guide JUNE 2013

HP Business Availability Center

Installing the IPSecuritas IPSec Client

QuadraMed Enterprise Scheduling Combined Service Installation Guide. Version 11.0

Sample Configuration: Cisco UCS, LDAP and Active Directory

Software project management. and. Maven

Tivoli Endpoint Manager for Security and Compliance Analytics. Setup Guide

Tutorial: BlackBerry Application Development. Sybase Unwired Platform 2.0

IBM VisualAge for Java,Version3.5. Remote Access to Tool API

CA Unified Infrastructure Management

CA SiteMinder. Web Agent Installation Guide for IIS. r12.5

CA Nimsoft Monitor. Probe Guide for File and directory checking. dirscan v3.0 series

Developing Applications for Integration between PI and SAP ERP in Different Network Domains or Landscapes

Transcription:

Nimsoft Monitor SOAP Web Services Getting Started Guide Version 2.0

Legal Notices Copyright 2012 CA. All rights reserved. Warranty The material contained in this document is provided "as is," and is subject to being changed, without notice, in future editions. Further, to the maximum extent permitted by applicable law, Nimsoft LLC disclaims all warranties, either express or implied, with regard to this manual and any information contained herein, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Nimsoft LLC shall not be liable for errors or for incidental or consequential damages in connection with the furnishing, use, or performance of this document or of any information contained herein. Should Nimsoft LLC and the user have a separate written agreement with warranty terms covering the material in this document that conflict with these terms, the warranty terms in the separate agreement shall control. Technology Licenses The hardware and/or software described in this document are furnished under a license and may be used or copied only in accordance with the terms of such license. No part of this manual may be reproduced in any form or by any means (including electronic storage and retrieval or translation into a foreign language) without prior agreement and written consent from Nimsoft LLC as governed by United States and international copyright laws. Restricted Rights Legend If software is for use in the performance of a U.S. Government prime contract or subcontract, Software is delivered and licensed as "Commercial computer software" as defined in DFAR 252.227-7014 (June 1995), or as a "commercial item" as defined in FAR 2.101(a) or as "Restricted computer software" as defined in FAR 52.227-19 (June 1987) or any equivalent agency regulation or contract clause. Use, duplication or disclosure of Software is subject to Nimsoft LLC s standard commercial license terms, and non-dod Departments and Agencies of the U.S. Government will receive no greater than Restricted Rights as defined in FAR 52.227-19(c)(1-2) (June 1987). U.S. Government users will receive no greater than Limited Rights as defined in FAR 52.227-14 (June 1987) or DFAR 252.227-7015 (b)(2) (November 1995), as applicable in any technical data. Trademarks Nimsoft is a trademark of CA. Adobe, Acrobat, Acrobat Reader, and Acrobat Exchange are registered trademarks of Adobe Systems Incorporated. Intel and Pentium are U.S. registered trademarks of Intel Corporation. Java(TM) is a U.S. trademark of Sun Microsystems, Inc. Microsoft and Windows are U.S. registered trademarks of Microsoft Corporation. Netscape(TM) is a U.S. trademark of Netscape Communications Corporation. Oracle is a U.S. registered trademark of Oracle Corporation, Redwood City, California. UNIX is a registered trademark of the Open Group. ITIL is a Registered Trade Mark of the Office of Government Commerce in the United Kingdom and other countries. All other trademarks, trade names, service marks and logos referenced herein belong to their respective companies. copyright 2012 CA 3

Table of Contents Prerequisites 5 Setup 6 Invoking Web Services using Microsoft Tools 12 Invoking Web Services using Soap UI 14 4

Prerequisites The following are required to make use of this quick start guide: Java 6 JDK Maven 2.2.1 (or later) (http://maven.apache.org/) Internet connection for downloading maven libraries. Running Nimsoft Monitor software with web services installed. Basic knowledge of Maven is a plus, but not required for getting started. We recommend that you add Maven bin directory to your system path (this is not required, but it will make running maven calls easier). copyright 2012 CA 5

Setup Follow these steps: 1. Create a new project folder. 2. Create the subdirectories within this folder: src/main/java src/test/java 3. Add the following content to a file called pom.xml: <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelversion>4.0.0</modelversion> <groupid>com.mycompany</groupid> <artifactid>nimbus-webservices</artifactid> <packaging>jar</packaging> <version>1.0-snapshot</version> <dependencies> <dependency> <groupid>org.apache.cxf</groupid> <artifactid>cxf-rt-frontend-jaxws</artifactid> <version>${cxf.version}</version> </dependency> <dependency> <groupid>org.apache.cxf</groupid> <artifactid>cxf-rt-ws-security</artifactid> <version>${cxf.version}</version> </dependency> <dependency> <groupid>org.apache.cxf</groupid> <artifactid>cxf-rt-transports-http</artifactid> <version>${cxf.version}</version> </dependency> <dependency> <groupid>org.apache.cxf</groupid> <artifactid>cxf-rt-frontend-simple</artifactid> <version>${cxf.version}</version> </dependency> <dependency> 6

<groupid>junit</groupid> <artifactid>junit</artifactid> <version>4.7</version> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <!-- enable java 6 --> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> <plugin> <groupid>org.apache.cxf</groupid> <artifactid>cxf-codegen-plugin</artifactid> <version>${cxf.version}</version> <executions> <execution> <id>generate-sources</id> <phase>generate-sources</phase> <configuration> <sourceroot>${project.build.directory}/generated/cxf</sourceroot> <wsdloptions> <wsdl>${ws.address}accountws?wsdl</wsdl> <wsdl>${ws.address}alarmws?wsdl</wsdl> <wsdl>${ws.address}dashboardws?wsdl</wsdl> <wsdl>${ws.address}nimbusws?wsdl</wsdl> <wsdl>${ws.address}probews?wsdl</wsdl> <wsdl>${ws.address}qosws?wsdl</wsdl> Setup 7

<wsdl>${ws.address}slaws?wsdl</wsdl> <wsdl>${ws.address}slows?wsdl</wsdl> <wsdl>${ws.address}userws?wsdl</wsdl> <wsdl>${ws.address}variablews?wsdl</wsdl> <wsdl>${ws.address}versionws?wsdl</wsdl> </wsdloptions> </configuration> <goals> <goal>wsdl2java</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <repositories> <repository> <id>apache-snapshots</id> <name>apache SNAPSHOT Repository</name> <url>http://repository.apache.org/snapshots/</url> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <properties> <cxf.version>2.2.4</cxf.version> <ws.address>http://localhost:8084/ws/</ws.address> </properties> </project> 8

4. If your Nimsoft Monitoring software web service is installed on a different host than localhost, change the properties entry in the bottom to reflect this. 5. Check that the web services are up and running by accessing the following URL: http://localhsot:8084/ws/ 6. From a command shell, run the maven command: mvn install. This generates service stubs for the web services, and they are ready for use. 7. Create project files for your IDEs. If you are running eclipse, enter: mvn eclipse:eclipse If you are running Intellij IDEA, enter: mvn idea:idea If you are running Netbeans, enter: mvn netbeans-freeform:generatenetbeans-project 8. Import project into your editor. In Eclipse, this is done by clicking File - > Import, and then selecting Existing Project into Workspace. 9. Create a new test class in src/test/java/test/getalarmstest.java with the following content: package test; import java.util.hashmap; import java.util.list; import org.apache.cxf.endpoint.client; import org.apache.cxf.frontend.clientproxy; import org.apache.cxf.jaxws.jaxwsproxyfactorybean; import org.apache.cxf.ws.security.wss4j.wss4joutinterceptor; import org.apache.ws.security.wsconstants; import org.apache.ws.security.handler.wshandlerconstants; import org.junit.test; import com.nimsoft.nms.services.alarm; import com.nimsoft.nms.services.alarmws; public class GetAlarmsTest { static final String PASSWORD = "<password> ; static final String USER_NAME = <user> ; static final String WS_ADDRESS = http://localhost:8084/ws/ ; @Test public void test_getalarms() { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setserviceclass(alarmws.class); factory.setaddress(ws_address + AlarmWS ); prepareservice(factory.create()); Setup 9

AlarmWS alarmservice = (AlarmWS) factory.create(); List<Alarm> alarms = alarmservice.getalarms(); } System.out.println( Number of alarms: + alarms.size()); void prepareservice(object accountservice) { Client client = ClientProxy.getClient(accountService); HashMap<String, Object> outprops = new HashMap<String, Object>(); outprops.put(wshandlerconstants.action, WSHandlerConstants.USERNAME_TOKEN); outprops.put(wshandlerconstants.user, USER_NAME); outprops.put(wshandlerconstants.password_type, WSConstants.PW_TEXT); outprops.put(wshandlerconstants.pw_callback_class, ClientPasswordHandler.class.getName()); } } WSS4JOutInterceptor wssout = new WSS4JoutInterceptor(outProps); client.getoutinterceptors().add(wssout); 10. Add the file ClientPasswordHandler.java in the same package. This file is used by CXF to handle the password in ws-security. package test; import java.io.ioexception; import javax.security.auth.callback.callback; import javax.security.auth.callback.callbackhandler; import javax.security.auth.callback.unsupportedcallbackexception; import org.apache.ws.security.wspasswordcallback; public class ClientPasswordHandler implements CallbackHandler { public void handle(callback[] callbacks) throws IOException, UnsupportedCallbackException { WSPasswordCallback pc = (WSPasswordCallback) callbacks[0]; } } pc.setpassword(getalarmstest.password); 10

11. Replace <user> and <password> with a user with access to the service. 12. Test your service by running the class GetAlarmsTest as a Junit test. 13. For consuming other web-services, replace AlarmWS with some of the other provided interfaces. Setup 11

Invoking Web Services using Microsoft Tools Use https for the transport. Setting WASP to use https involves a raw configure of the https_port key; set it to default of 443. Without https,.net WCF will not allow clear username and password. Using https requires code that deals with the certificate validation. You could consider validating any certificate. The task is to create a custom binding in APP.CONFIG that works. The <security> section below is crucial, and.net WCF will not build it for you in Visual Studio. <custombinding> <binding name="mybinding"> <security authenticationmode="usernameovertransport" messagesecurityversion="wssecurity11wstrustfebruary2005wssecureconv ersationfebruary2005wssecuritypolicy11" securityheaderlayout="strict" includetimestamp="false" requirederivedkeys="true"> </security> <textmessageencoding messageversion="soap11" /> <httpstransport authenticationscheme="negotiate" requireclientcertificate ="false" realm =""/> </binding> </custombinding> IMPORTANT: Set the messageversion to Soap11 not the default of Soap12. 12

The following example below should now work: Imports System.ServiceModel Imports System.ServiceModel.Channels Imports System.Net Imports System.Net.Security Imports System.Security.Cryptography.X509Certificates Imports System.ServiceModel.Dispatcher Imports System.ServiceModel.Description Imports System.ServiceModel.Configuration ' for BehaviorExtensionElement Public Class TestUtils Public Shared Sub OverrideCertificateValidation() ServicePointManager.ServerCertificateValidationCallback = New RemoteCertificateValidationCallback(AddressOf RemoteCertValidate) End Sub Private Shared Function RemoteCertValidate(ByVal sender As Object, ByVal cert As X509Certificate, ByVal chain As X509Chain, ByVal [error] As System.Net.Security.SslPolicyErrors) As Boolean Return True End Function End Class Module Module1 Sub Main() TestUtils.OverrideCertificateValidation() Dim CallWebService As New nimsoftversion2.versionwsclient() CallWebService.ClientCredentials.UserName.UserName = "administrator" CallWebService.ClientCredentials.UserName.Password = "<password>" Dim sgetvalue As String = "blank" sgetvalue = CallWebService.getVersion() System.Console.WriteLine("Nimsoft Web Services version: " & sgetvalue) System.Console.Read() End Sub End Module Invoking Web Services using Microsoft Tools 13

Invoking Web Services using Soap UI First add the WSDL you want to test to your project. You will find all available WSDL if go to the URL that points to your wasp: http://localhost:8084/ws/. The WSDL to the account service is then: http://localhost:8084/ws/accountws?wsdl You should now have the available calls in Soap UI: 14

Now you must configure authentication parameters: Right click your project and open Show Project View. Navigate to the Security Configurations. First add an outgoing WS-Security configurations (see the + sign above the first line, and then add a new WSS Entry: In your request 1 for the service you want to call, right click and select menu point Outgoing WSS and select Apply administrator (or whatever your entry was called). You will now get a <wsse:security token and you should be able to call the wesbservice and get the response back that you want. Invoking Web Services using Soap UI 15