25.01.2013 Views

HP Software OM Tips & Techniques

HP Software OM Tips & Techniques

HP Software OM Tips & Techniques

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Example<br />

Below /opt/OV/contrib/OprWsInc/clients/ you get three example implementations for:<br />

axis wcf wiseman<br />

Example: Generate incidents (<strong>OM</strong> msgs) using the Wiseman client<br />

public class WsmanClientTester_hpeter<br />

{<br />

private static WsmanClient client;<br />

private static EndpointReferenceType epr;<br />

public static void main(String[] args) throws Exception<br />

{<br />

client =<br />

new WsmanClient("opc_adm", // username<br />

"opc_adm", // passwd<br />

"", // keystore (optional)<br />

"com.hp.schemas.ism.serviceoperation.incidentmanagement._1.incident",<br />

"com.hp.schemas.ism.serviceoperation.incidentmanagement._1.incidentextensions",<br />

"com.hp.schemas.opr.ws.serviceoperation.incidentmanagement._1.incident",<br />

"com.hp.schemas.opr.ws.serviceoperation.incidentmanagement._1.incident.change",<br />

"com.hp.schemas.opr.ws.serviceoperation.incidentmanagement._1.incidentfilter");<br />

// Base incident EndpointReference to which server it should go<br />

epr =<br />

WsmanClient.createEndpointReference("https://elisa.deu.hp.com:8444/opr-webservice/Incident.svc",<br />

"http://schemas.hp.com/ism/ServiceOperation/IncidentManagement/1/Incident",<br />

null);<br />

Incident incident = new Incident();<br />

IncidentHelper.setEmittingNode(incident, "elisa.deu.hp.com"); //msg node<br />

IncidentHelper.setAssignedOperator(incident, "opc_op"); //own message immediately<br />

incident.setTitle("Hello World, I am ws-man client"); //msg_text<br />

incident.setSeverity("Minor"); //severity<br />

JAXBElement incidentElement = new JAXBElement(QNames.INCIDENT, Incident.class, null, incident);<br />

35EndpointReferenceType 4 June 2008 incidentEpr = client.create(incidentElement, epr);<br />

// read message from server and print out all attributes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!