Thursday, 12 July 2012

How to to create incident in HP OMU use Perl and Incident Web Service IWS

HPOM has library WSOM-Lib_0.01_7. It located  /opt/OV/contrib/OprWsIncPerl/.  
There are some example:

Let's Create incident in OMU by IWS use WSOM-lib (use soap and wsdl). It's very quickly:



#!perl


###################################################################################
# Example Create
###################################################################################
#
# This example shows how to use the Perl library to create an 
# incident in OM.
# Please change the following things to use this example:
# - Webservice Address ("->to")
# - Username and Password ("->auth")
# - DNS name of the emitting node (to see the incident in the OM Java GUI)
#  ("->bodyDnsEmittingNode")
#
#################################################################################


use WSOM::Lib; 


my $newIncident = WSOM::Lib->create
->to('http://192.168.81.81:8081/opr-webservice/Incident.svc') # Change the web service address
->auth('user', 'pass') # change the username and password 
->bodyTitle('Demo Incident')
->bodyDnsEmittingNode('somenode') # insert an existing node (otherwise the incident will be deleted immediately)
->bodySeverity('Normal')
->bodyDescription('This is a brand new incident. The incident was created using the WSOM Perl library.')
->execute;


if (!$newIncident->fault)
{
print "Incident was created: ".$newIncident->incidentID;
}
else
{
print "An error occurred !\n".$newIncident->faultstring;
}


Incident Web Service Perl Library OMU 9.10 WebService Integration

No comments:

Post a Comment