Showing posts with label OVSD. Show all posts
Showing posts with label OVSD. Show all posts

Wednesday, July 16, 2008

Check Version of OVSD web-api.jar

When you use the HP OpenView Service Desk (OVSD) web-api.jar to write programs that access the OVSD server you should use the same version that the server is using. The obvious question soon becomes, how do I know what version of the web-api.jar do I have. To determine the version of your web-api.jar do the following: 1. Locate the web-api.jar file you are compiling against in your program. 2. Open a command prompt and cd to the directory that contains your web-api.jar, so that it is your current directory. 3. Now type (or copy and paste) java -classpath web-api.jar com.hp.ifc.sys.AppVersionInfo This should return something like: Acronym: SD Version: 4.5.0588.1706 (SP17) Company: hp OpenView Copyright: Copyright (c) 2004 Hewlett-Packard Development Company, L.P. All Rights Reserved. Description: service desk is a family member of the hp OpenView suite. ProductID: B4321 ProductName: hp OpenView service desk If you don't know what version your server is running the easiest way to tell is to open your client software and look at the start up splash page. If you want a more detailed answer like the above info, you can do the following: 1. Execute C:\Program Files\Hewlett-Packard\OpenView\service desk 4.5\client\bin\sd_version.bat by double clicking it. This should return the same thing as you got for the web-api.jar info.

Friday, June 27, 2008

A safe way to save entities in HP OpenView Service Desk (OVSD) web-api

If you have have worked with HP OpenView Service Desk (OVSD) web-api, you may have noticed sometimes it throws an exception that says "There are no changes to save." when you call the save() method on entities such as Servicecall, Workorder, Change, etc. This is annoying and fairly useless thing to know if you ask me. This should not be an exception in my opinion if you call save too often, especially since the api doesn't support transactions. Instead of repeating the same try catch blocks everywhere in my code, it became obvious to me that the safest thing to do is to just write a very simple method to call instead of the standard save() method on an entity. What the method below does is allows you to pass virtually any type of entity from HPOV web-api objects that have a save() method or more specifically inherit from IApiEntity object (this is at least all the major ones). Now instead of ... myServiceCallObject.save(); just call the method and pass it the object you want to save. SaveEntity(myServiceCallObject); This is clean and reduces unexpected bugs caused by this "exception" :) private void SaveEntity(IApiEntity entity) throws Exception { try{ entity.save(); } catch (Exception ex) { if (!ex.getMessage().equalsIgnoreCase("There are no changes to save.")) { throw ex; } } }

HP OpenView Service Desk Web-api saves when you don't expect it to.

To be fair, I have not looked in the documentation of the HP OpenView web-api docs, but I can't believe that records can be saved without called .save() method on an object. How you ask, here is an example in pseudo-code.
IWorkorder myNewWorkOrder = WorkOrderHome().openNewWorkorder(); IServicecall myExistingServiceCall = ServiceCallHome().openServicecall(1234l); // no work order will exist and will not be related to the service call before the call to the next line myExistingServiceCall.addWorkorder(myNewWorkOrder); // after the above call, the work order exists, and IS related to the service call. I could not believe it, but this is true. A word of caution if you mean to not save in all cases.

Thursday, June 26, 2008

HP OpenView template field returns null from Web-api

I tried to come up with a title for this that made sense, but it is just a weird problem really. I thought there was a bug in HP OpenView, but I am now confident it is a configuration issue. Here is the behavior I saw that will help explain what the issue is. I have a work order (though this issue is not specific to work orders I suspect) template. I have set the assigned to workgroup to a workgroup that happens to be inactive. Obviously I would not do this on purpose. Actually someone made the workgroup inactive and didn't know that the template was using it and should be updated. The issue is that when you create a work order using this template it shows the value of the assigned to workgroup field as blank (in the HP OpenView Service Desk Client) or null (in the case of the Java web-api. If you know that inactive workgroups show as blank or null then there is no problem. However, it is VERY frustrating when in the template you see a workgroup set, and in the UI and web-api call you see blank or null respectively. It just doesn't make sense without knowing this quirk. So, I hope this helps others. One other caveat to this is that IF the assigned to person is specified in the template then (at least with our business rules, I don't know if this is default behavior) the assigned to workgroup is changed to the workgroup of the assigned to person assuming that the workgroup is inactive. This was the main confusing part. We removed the assigned to person, and started getting validation errors that said the assigned to workgroup was null. So, while they seem unrelated, they are related in particular circumstances.
Good luck to all.

Wednesday, September 12, 2007

How to optimize HP OpenView Service Desk web-api calls

Open HP OpenvView Service Desk (OVSD). Go to the System administration module. In the tree select Data and then Web Api Application. Add a new item and give it a name. This is the name you will reference in your code. Add the attributes you will be using in your code. It is important to include as many of the columns as possible. Otherwise, they will be loaded on demand when you access them and this takes more time. Now that you have a Web Api Application defined in OVSD use the following code to use it in your code. public void SetWebApiApplication(ApiSDSession session, String appName) { IWebApiApplicationWhere where; IWebApiApplication[] applications; IWebApiApplication appl1; // Find the application mentioned in the argument. IWebApiApplicationHome applicationHome = session.getWebApiApplicationHome(); where= applicationHome.createWebApiApplicationWhere(); where.addCriteriumOnText(appName); applications = applicationHome.findWebApiApplication(where); if (applications == null) { System.out.println("There is no Web Api application called " + appName); return; } appl1= applications[0]; session.setApplicationSettings(appl1); } Essentially, when you use Web Api Application it is like doing the following in SQL. select col1, col5, col34 from MyLargeTable instead of select * from MyLargeTable You may not realize it, but I think OVSD also uses a "select" to do an update of data as well. The reason for this conclusion is that you must still search for the record you want to update, load the data into memory, make the modification, and then write change back to database. With that said, the biggest performance gain is going to be when you bring back many records instead of just one. There is still a performance gain for one or two records, but it is negligible in most cases because you have to specify the Web Api Application before you do the actual query.

Friday, August 3, 2007

Exporting Business Rules from HP OpenView Service Desk to Excel

Using the HP OpenView Service Desk client open the Administrator Console. Then navigate to the Business Logic node. Expand that portion of the tree to show the Database Rules and UI Rules nodes. Click on which ever set of rules you would like to export. Go to the File menu, change Report Style to Table or better yet a Bordered Table. Then choose Print Preview from the same File menu. Click or highlight some of the text in the preview. Then do a control-A and then control-C to select all text and then copy. Go to MS Excel, open a new worksheet, and paste. You will need to make it pretty, but all the data is there. I recommend setting the column height to something like 12.75 if you like the default height that you usually get from a new Excel spreadsheet.

Thursday, July 12, 2007

HP Open View Service Desk web-api maybe long, but isn't Long

If the title of this blog is confusing, you may also find this blog confusing not because the content is confusing, but because you won't be able to understand what the developers that designed web-api were thinking. HP Open View Service Desk (OVSD) web-api is a set of java api's that have little to do with the web as far as I can tell. It is an api for OVSD that is implemented in Java and jarred. No big deal there, just a strange name. OVSD has a concept of OID and ID for some records like Service Calls. ID is what the unique id that is shown in the UI that end users use. OID is the unique ID that is used in Oracle for relationships. My big conundrum is what were the developers thinking when they created two methods to open (find and load) and service call. The two methods are called openServicecall(). It is overloaded to accept a Long or a long. Long is an object in Java, and long is a primitive in Java. Very different things. One might think that the developers were nice and just provided the ability to pass either an object or primitive. This would make sense, but is not what they did. They made long mean ID and Long mean OID. Only place to get that is in the documentation. Below is the correct snippet for opening a service call by ID (the end user value). ApiSDSession session = null; try { session = ApiSDSession.openSession(server, username, password); IServicecallHome scHome = session.getServicecallHome(); long id = 123456; // NOTE: long MUST be used, NOT Long IServicecall serviceCall = scHome.openServicecall(id); } catch (Exception ex) { // handle exception here } finally { session.closeConnection(); } I hope this saves someone hours of frustration.

Wednesday, September 6, 2006

Making the relationship between OSVD objects

I wasted way too much time trying to figure this out, so I thought I would try to save others from doing the same. OVSD has a webapi available for Java. The api is quite nice. One thing that was not obvious to me at first, but kind of makes sense in the end is how to make relationships between objects. Let's assume you are creating a service call. The service call has a relationship to an assignment which as a relationship to a workgroup. Long templateID = 12345l; // note the lowercase L at the end to designate a LONG. IServicecall sc = ServiceCallHome().openNewServicecall(templateID); The first lesson is that you cannot create the assignment directly. You must call the getAssignment() method on the service call; it creates it for you. IAssignment ia = sc.getAssignment(); The next thing we do is make the relationship to the to-workgroup by calling the the setAssWorkgroup() on the assignment object. ia.setAssWorkgroup(GetServiceDesk1stLineWorkgroup()); The second lesson comes when trying to save changes. In OVSD webapi related objects don't use a save method. Instead they have a transfer() method that does some magic, but is basically the same as a save on a child/related object. ia.transfer(); Finally, call save() on the service call to save all changes to database. sc.save();